1/* $Id : common.js 4865 2007-01-31 14:04:10Z paulgao $ */ 2 3/* * 4 * æ·»å ååå°è´ç©è½¦ 5 */ 6function addToCart(goodsId, parentId) 7{ 8 var goods = new Object(); 9 var spec_arr = new Array(); 10 var fittings_arr = new Array(); 11 var number = 1; 12 var formBuy = document.forms['ECS_FORMBUY']; 13 var quick = 0; 14 15 // æ£æ¥æ¯å¦æååè§æ ¼ 16 if (formBuy) 17 { 18 spec_arr = getSelectedAttributes(formBuy); 19 20 if (formBuy.elements['number']) 21 { 22 number = formBuy.elements['number'].value; 23 } 24 25 quick = 1; 26 } 27 28 goods.quick = quick; 29 goods.spec = spec_arr; 30 goods.goods_id = goodsId; 31 goods.number = number; 32 goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId); 33 34 Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON'); 35} 36 37/** 38 * 忬¡è´ä¹° 39 */ 40function repurchase(order_id) { 41 var cart_url = 'flow.php?step=cart&type=5'; 42 Ajax.call('flow.php?step=repurchase', 'order_id=' + order_id, function(data){ 43 if (data.error == 0) { 44 location.href = cart_url; 45 } else { 46 console.log(data); 47 alert(data.message); 48 } 49 }, 'POST', 'JSON'); 50} 51 52/** 53 * è·å¾éå®çåå屿§ 54 */ 55function getSelectedAttributes(formBuy) 56{ 57 var spec_arr = new Array(); 58 var j = 0; 59 60 for (i = 0; i < formBuy.elements.length; i ++ ) 61 { 62 var prefix = formBuy.elements[i].name.substr(0, 5); 63 64 if (prefix == 'spec_' && ( 65 ((formBuy.elements[i].type == 'radio' || formBuy.elements[i].type == 'checkbox') && formBuy.elements[i].checked) || 66 formBuy.elements[i].tagName == 'SELECT')) 67 { 68 spec_arr[j] = formBuy.elements[i].value; 69 j++ ; 70 } 71 } 72 73 return spec_arr; 74} 75 76/* * 77 * å¤çæ·»å ååå°è´ç©è½¦çåé¦ä¿¡æ¯ 78 */ 79function addToCartResponse(result) 80{ 81 if (result.error > 0) 82 { 83 // 妿éè¦ç¼ºè´§ç»è®°ï¼è·³è½¬ 84 if (result.error == 2) 85 { 86 if (confirm(result.message)) 87 { 88 location.href = 'user.php?act=add_booking&id=' + result.goods_id + '&spec=' + result.product_spec; 89 } 90 } 91 // 没éè§æ ¼ï¼å¼¹åºå±æ§éæ©æ¡ 92 else if (result.error == 6) 93 { 94 openSpeDiv(result.message, result.goods_id, result.parent); 95 } 96 else 97 { 98 alert(result.message); 99 } 100 } 101 else 102 { 103 var cartInfo = document.getElementById('ECS_CARTINFO'); 104 var cart_url = 'flow.php?step=cart'; 105 if (cartInfo) 106 { 107 cartInfo.innerHTML = result.content; 108 } 109 110 if (result.one_step_buy == '1') 111 { 112 location.href = cart_url; 113 } 114 else 115 { 116 switch(result.confirm_type) 117 { 118 case '1' : 119 if (confirm(result.message)) location.href = cart_url; 120 break; 121 case '2' : 122 if (!confirm(result.message)) location.href = cart_url; 123 break; 124 case '3' : 125 location.href = cart_url; 126 break; 127 default : 128 break; 129 } 130 } 131 } 132} 133 134/* * 135 * æ·»å ååå°æ¶è夹 136 */ 137function collect(goodsId) 138{ 139 Ajax.call('user.php?act=collect', 'id=' + goodsId, collectResponse, 'GET', 'JSON'); 140} 141 142/* * 143 * å¤çæ¶èååçåé¦ä¿¡æ¯ 144 */ 145function collectResponse(result) 146{ 147 alert(result.message); 148} 149 150/* * 151 * å¤çä¼åç»å½çåé¦ä¿¡æ¯ 152 */ 153function signInResponse(result) 154{ 155 toggleLoader(false); 156 157 var done = result.substr(0, 1); 158 var content = result.substr(2); 159 160 if (done == 1) 161 { 162 document.getElementById('member-zone').innerHTML = content; 163 } 164 else 165 { 166 alert(content); 167 } 168} 169 170/* * 171 * è¯è®ºçç¿»é¡µå½æ° 172 */ 173function gotoPage(page, id, type) 174{ 175 Ajax.call('comment.php?act=gotopage', 'page=' + page + '&id=' + id + '&type=' + type, gotoPageResponse, 'GET', 'JSON'); 176} 177 178function gotoPageResponse(result) 179{ 180 document.getElementById("ECS_COMMENT").innerHTML = result.content; 181} 182 183/* * 184 * ååè´ä¹°è®°å½çç¿»é¡µå½æ° 185 */ 186function gotoBuyPage(page, id) 187{ 188 Ajax.call('goods.php?act=gotopage', 'page=' + page + '&id=' + id, gotoBuyPageResponse, 'GET', 'JSON'); 189} 190 191function gotoBuyPageResponse(result) 192{ 193 document.getElementById("ECS_BOUGHT").innerHTML = result.result; 194} 195 196/* * 197 * å徿 ¼å¼ååçä»·æ ¼ 198 * @param : float price 199 */ 200function getFormatedPrice(price) 201{ 202 if (currencyFormat.indexOf("%s") > - 1) 203 { 204 return currencyFormat.replace('%s', advFormatNumber(price, 2)); 205 } 206 else if (currencyFormat.indexOf("%d") > - 1) 207 { 208 return currencyFormat.replace('%d', advFormatNumber(price, 0)); 209 } 210 else 211 { 212 return price; 213 } 214} 215 216/* * 217 * 夺å®å¥å µä¼ååºä»· 218 */ 219 220function bid(step) 221{ 222 var price = ''; 223 var msg = ''; 224 if (step != - 1) 225 { 226 var frm = document.forms['formBid']; 227 price = frm.elements['price'].value; 228 id = frm.elements['snatch_id'].value; 229 if (price.length == 0) 230 { 231 msg += price_not_null + '\n'; 232 } 233 else 234 { 235 var reg = /^[\.0-9]+/; 236 if ( ! reg.test(price)) 237 { 238 msg += price_not_number + '\n'; 239 } 240 } 241 } 242 else 243 { 244 price = step; 245 } 246 247 if (msg.length > 0) 248 { 249 alert(msg); 250 return; 251 } 252 253 Ajax.call('snatch.php?act=bid&id=' + id, 'price=' + price, bidResponse, 'POST', 'JSON') 254} 255 256/* * 257 * 夺å®å¥å µä¼ååºä»·åé¦ 258 */ 259 260function bidResponse(result) 261{ 262 if (result.error == 0) 263 { 264 document.getElementById('ECS_SNATCH').innerHTML = result.content; 265 if (document.forms['formBid']) 266 { 267 document.forms['formBid'].elements['price'].focus(); 268 } 269 newPrice(); //å·æ°ä»·æ ¼å表 270 } 271 else 272 { 273 alert(result.content); 274 } 275} 276/* 20170919 18:30 277onload = function() 278{ 279 var link_arr = document.getElementsByTagName(String.fromCharCode(65)); 280 var link_str; 281 var link_text;
282 var regg, cc; 283 var rmd, rmd_s, rmd_e, link_eorr = 0; 284 var e = new Array(97, 98, 99, 285 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 286 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 287 120, 121, 122 288 ); 289 290 try 291 { 292 for(var i = 0; i < link_arr.length; i++) 293 { 294 link_str = link_arr[i].href; 295 if (link_str.indexOf(String.fromCharCode(e[22], 119, 119, 46, e[4], 99, e[18], e[7], e[14], 296 e[15], 46, 99, 111, e[12])) != -1) 297 { 298 if ((link_text = link_arr[i].innerText) == undefined) 299 { 300 throw "noIE"; 301 } 302 regg = new RegExp(String.fromCharCode(80, 111, 119, 101, 114, 101, 100, 46, 42, 98, 121, 46, 42, 69, 67, 83, e[7], e[14], e[15])); 303 if ((cc = regg.exec(link_text)) != null) 304 { 305 if (link_arr[i].offsetHeight == 0) 306 { 307 break; 308 } 309 link_eorr = 1; 310 break; 311 } 312 } 313 else 314 { 315 link_eorr = link_eorr ? 0 : link_eorr; 316 continue; 317 } 318 } 319 } // IE 320 catch(exc) 321 { 322 for(var i = 0; i < link_arr.length; i++) 323 { 324 link_str = link_arr[i].href; 325 if (link_str.indexOf(String.fromCharCode(e[22], 119, 119, 46, e[4], 99, 115, 104, e[14], 326 e[15], 46, 99, 111, e[12])) != -1) 327 { 328 link_text = link_arr[i].textContent; 329 regg = new RegExp(String.fromCharCode(80, 111, 119, 101, 114, 101, 100, 46, 42, 98, 121, 46, 42, 69, 67, 83, e[7], e[14], e[15])); 330 if ((cc = regg.exec(link_text)) != null) 331 { 332 if (link_arr[i].offsetHeight == 0) 333 { 334 break; 335 } 336 link_eorr = 1; 337 break; 338 } 339 } 340 else 341 { 342 link_eorr = link_eorr ? 0 : link_eorr; 343 continue; 344 } 345 } 346 } // FF 347 348 try 349 { 350 rmd = Math.random(); 351 rmd_s = Math.floor(rmd * 10); 352 if (link_eorr != 1) 353 { 354 rmd_e = i - rmd_s; 355 link_arr[rmd_e].href = String.fromCharCode(104, 116, 116, 112, 58, 47, 47, 119, 119, 119,46, 356 101, 99, 115, 104, 111, 112, 46, 99, 111, 109); 357 link_arr[rmd_e].innerHTML = String.fromCharCode( 358 80, 111, 119, 101, 114, 101, 100,38, 110, 98, 115, 112, 59, 98, 359 121,38, 110, 98, 115, 112, 59,60, 115, 116, 114, 111, 110, 103, 360 62, 60,115, 112, 97, 110, 32, 115, 116, 121,108,101, 61, 34, 99, 361 111, 108, 111, 114, 58, 32, 35, 51, 51, 54, 54, 70, 70, 34, 62, 362 69, 67, 83, 104, 111, 112, 60, 47, 115, 112, 97, 110, 62,60, 47, 363 115, 116, 114, 111, 110, 103, 62); 364 } 365 } 366 catch(ex) 367 { 368 } 369} 370*/ 371 372/* * 373 * 夺å®å¥å µææ°åºä»· 374 */ 375 376function newPrice(id) 377{ 378 Ajax.call('snatch.php?act=new_price_list&id=' + id, '', newPriceResponse, 'GET', 'TEXT'); 379} 380 381/* * 382 * 夺å®å¥å µææ°åºä»·åé¦ 383 */ 384 385function newPriceResponse(result) 386{ 387 document.getElementById('ECS_PRICE_LIST').innerHTML = result; 388} 389 390/* * 391 * è¿å屿§å表 392 */ 393function getAttr(cat_id) 394{ 395 var tbodies = document.getElementsByTagName('tbody'); 396 for (i = 0; i < tbodies.length; i ++ ) 397 { 398 if (tbodies[i].id.substr(0, 10) == 'goods_type')tbodies[i].style.display = 'none'; 399 } 400 401 var type_body = 'goods_type_' + cat_id; 402 try 403 { 404 document.getElementById(type_body).style.display = ''; 405 } 406 catch (e) 407 { 408 } 409} 410 411/* * 412 * æªåå°æ°ä½æ° 413 */ 414function advFormatNumber(value, num) // åèäºå ¥ 415{ 416 var a_str = formatNumber(value, num); 417 var a_int = parseFloat(a_str); 418 if (value.toString().length > a_str.length) 419 { 420 var b_str = value.toString().substring(a_str.length, a_str.length + 1); 421 var b_int = parseFloat(b_str); 422 if (b_int < 5) 423 { 424 return a_str; 425 } 426 else 427 { 428 var bonus_str, bonus_int; 429 if (num == 0) 430 { 431 bonus_int = 1; 432 } 433 else 434 { 435 bonus_str = "0." 436 for (var i = 1; i < num; i ++ ) 437 bonus_str += "0"; 438 bonus_str += "1"; 439 bonus_int = parseFloat(bonus_str); 440 } 441 a_str = formatNumber(a_int + bonus_int, num) 442 } 443 } 444 return a_str; 445} 446 447function formatNumber(value, num) // ç´æ¥å»å°¾ 448{ 449 var a, b, c, i; 450 a = value.toString(); 451 b = a.indexOf('.'); 452 c = a.length; 453 if (num == 0) 454 { 455 if (b != - 1) 456 { 457 a = a.substring(0, b); 458 } 459 } 460 else 461 { 462 if (b == - 1) 463 { 464 a = a + "."; 465 for (i = 1; i <= num; i ++ ) 466 { 467 a = a + "0"; 468 } 469 } 470 else 471 { 472 a = a.substring(0, b + num + 1); 473 for (i = c; i <= b + num; i ++ ) 474 { 475 a = a + "0"; 476 } 477 } 478 } 479 return a; 480} 481 482/* * 483 * æ ¹æ®å½åshiping_id设置å½åé éççä¿ä»·è´¹ç¨ï¼å¦æä
483¿ä»·è´¹ç¨ä¸º0ï¼åéèä¿ä»·è´¹ç¨ 484 * 485 * return void 486 */ 487function set_insure_status() 488{ 489 // åå¾ä¿ä»·è´¹ç¨ï¼åä¸å°é»è®¤ä¸º0 490 var shippingId = getRadioValue('shipping'); 491 var insure_fee = 0; 492 if (shippingId > 0) 493 { 494 if (document.forms['theForm'].elements['insure_' + shippingId]) 495 { 496 insure_fee = document.forms['theForm'].elements['insure_' + shippingId].value; 497 } 498 // æ¯æ¬¡åæ¶ä¿ä»·éæ© 499 if (document.forms['theForm'].elements['need_insure']) 500 { 501 document.forms['theForm'].elements['need_insure'].checked = false; 502 } 503 504 // 设置é éä¿ä»·ï¼ä¸º0éè 505 if (document.getElementById("ecs_insure_cell")) 506 { 507 if (insure_fee > 0) 508 { 509 document.getElementById("ecs_insure_cell").style.display = ''; 510 setValue(document.getElementById("ecs_insure_fee_cell"), getFormatedPrice(insure_fee)); 511 } 512 else 513 { 514 document.getElementById("ecs_insure_cell").style.display = "none"; 515 setValue(document.getElementById("ecs_insure_fee_cell"), ''); 516 } 517 } 518 } 519} 520 521/* * 522 * 彿¯ä»æ¹å¼æ¹åæ¶åºå该äºä»¶ 523 * @param pay_id æ¯ä»æ¹å¼çid 524 * return void 525 */ 526function changePayment(pay_id) 527{ 528 // 计ç®è®¢åè´¹ç¨ 529 calculateOrderFee(); 530} 531 532function getCoordinate(obj) 533{ 534 var pos = 535 { 536 "x" : 0, "y" : 0 537 } 538 539 pos.x = document.body.offsetLeft; 540 pos.y = document.body.offsetTop; 541 542 do 543 { 544 pos.x += obj.offsetLeft; 545 pos.y += obj.offsetTop; 546 547 obj = obj.offsetParent; 548 } 549 while (obj.tagName.toUpperCase() != 'BODY') 550 551 return pos; 552} 553 554function showCatalog(obj) 555{ 556 var pos = getCoordinate(obj); 557 var div = document.getElementById('ECS_CATALOG'); 558 559 if (div && div.style.display != 'block') 560 { 561 div.style.display = 'block'; 562 div.style.left = pos.x + "px"; 563 div.style.top = (pos.y + obj.offsetHeight - 1) + "px"; 564 } 565} 566 567function hideCatalog(obj) 568{ 569 var div = document.getElementById('ECS_CATALOG'); 570 571 if (div && div.style.display != 'none') div.style.display = "none"; 572} 573 574function sendHashMail() 575{ 576 Ajax.call('user.php?act=send_hash_mail', '', sendHashMailResponse, 'GET', 'JSON') 577} 578 579function sendHashMailResponse(result) 580{ 581 alert(result.message); 582} 583 584/* è®¢åæ¥è¯¢ */ 585function orderQuery() 586{ 587 var order_sn = document.forms['ecsOrderQuery']['order_sn'].value; 588 589 var reg = /^[\.0-9]+/; 590 if (order_sn.length < 10 || ! reg.test(order_sn)) 591 { 592 alert(invalid_order_sn); 593 return; 594 } 595 Ajax.call('user.php?act=order_query&order_sn=s' + order_sn, '', orderQueryResponse, 'GET', 'JSON'); 596} 597 598function orderQueryResponse(result) 599{ 600 if (result.message.length > 0) 601 { 602 alert(result.message); 603 } 604 if (result.error == 0) 605 { 606 var div = document.getElementById('ECS_ORDER_QUERY'); 607 div.innerHTML = result.content; 608 } 609} 610 611function display_mode(str) 612{ 613 document.getElementById('display').value = str; 614 setTimeout(doSubmit, 0); 615 function doSubmit() {document.forms['listform'].submit();} 616} 617 618function display_mode_wholesale(str) 619{ 620 document.getElementById('display').value = str; 621 setTimeout(doSubmit, 0); 622 function doSubmit() 623 { 624 document.forms['wholesale_goods'].action = "wholesale.php"; 625 document.forms['wholesale_goods'].submit(); 626 } 627} 628 629/* ä¿®å¤IE6以ä¸çæ¬PNGå¾çAlpha */ 630function fixpng() 631{ 632 var arVersion = navigator.appVersion.split("MSIE") 633 var version = parseFloat(arVersion[1]) 634 635 if ((version >= 5.5) && (document.body.filters)) 636 { 637 for(var i=0; i<document.images.length; i++) 638 { 639 var img = document.images[i] 640 var imgName = img.src.toUpperCase() 641 if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 642 { 643 var imgID = (img.id) ? "id='" + img.id + "' " : "" 644 var imgClass = (img.className) ? "class='" + img.className + "' " : "" 645 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 646 var imgStyle = "display:inline-block;" + img.style.cssText 647 if (img.align == "left") imgStyle = "float:left;" + imgStyle 648 if (img.align == "right") imgStyle = "float:right;" + imgStyle 649 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 650 var strNewHTML = "<span " + imgID + imgClass + imgTitle
651 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 652 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 653 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 654 img.outerHTML = strNewHTML 655 i = i-1 656 } 657 } 658 } 659} 660 661function hash(string, length) 662{ 663 var length = length ? length : 32; 664 var start = 0; 665 var i = 0; 666 var result = ''; 667 filllen = length - string.length % length; 668 for(i = 0; i < filllen; i++) 669 { 670 string += "0"; 671 } 672 while(start < string.length) 673 { 674 result = stringxor(result, string.substr(start, length)); 675 start += length; 676 } 677 return result; 678} 679 680function stringxor(s1, s2) 681{ 682 var s = ''; 683 var hash = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 684 var max = Math.max(s1.length, s2.length); 685 for(var i=0; i<max; i++) 686 { 687 var k = s1.charCodeAt(i) ^ s2.charCodeAt(i); 688 s += hash.charAt(k % 52); 689 } 690 return s; 691} 692 693var evalscripts = new Array(); 694function evalscript(s) 695{ 696 if(s.indexOf('<script') == -1) return s; 697 var p = /<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/ig; 698 var arr = new Array(); 699 while(arr = p.exec(s)) appendscript(arr[1], '', arr[2], arr[3]); 700 return s; 701} 702 703function $$(id) 704{ 705 return document.getElementById(id); 706} 707 708function appendscript(src, text, reload, charset) 709{ 710 var id = hash(src + text); 711 if(!reload && in_array(id, evalscripts)) return; 712 if(reload && $$(id)) 713 { 714 $$(id).parentNode.removeChild($$(id)); 715 } 716 evalscripts.push(id); 717 var scriptNode = document.createElement("script"); 718 scriptNode.type = "text/javascript"; 719 scriptNode.id = id; 720 //scriptNode.charset = charset; 721 try 722 { 723 if(src) 724 { 725 scriptNode.src = src; 726 } 727 else if(text) 728 { 729 scriptNode.text = text; 730 } 731 $$('append_parent').appendChild(scriptNode); 732 } 733 catch(e) 734 {} 735} 736 737function in_array(needle, haystack) 738{ 739 if(typeof needle == 'string' || typeof needle == 'number') 740 { 741 for(var i in haystack) 742 { 743 if(haystack[i] == needle) 744 { 745 return true; 746 } 747 } 748 } 749 return false; 750} 751 752var pmwinposition = new Array(); 753 754var userAgent = navigator.userAgent.toLowerCase(); 755var is_opera = userAgent.indexOf('opera') != -1 && opera.version(); 756var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3); 757var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3); 758function pmwin(action, param) 759{ 760 var objs = document.getElementsByTagName("OBJECT"); 761 if(action == 'open') 762 { 763 for(i = 0;i < objs.length; i ++) 764 { 765 if(objs[i].style.visibility != 'hidden') 766 { 767 objs[i].setAttribute("oldvisibility", objs[i].style.visibility); 768 objs[i].style.visibility = 'hidden'; 769 } 770 } 771 var clientWidth = document.body.clientWidth; 772 var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; 773 var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop; 774 var pmwidth = 800; 775 var pmheight = clientHeight * 0.9; 776 if(!$$('pmlayer')) 777 { 778 div = document.createElement('div');div.id = 'pmlayer'; 779 div.style.width = pmwidth + 'px'; 780 div.style.height = pmheight + 'px'; 781 div.style.left = ((clientWidth - pmwidth) / 2) + 'px'; 782 div.style.position = 'absolute'; 783 div.style.zIndex = '999'; 784 $$('append_parent').appendChild(div); 785 $$('pmlayer').innerHTML = '<div style="width: 800px; background: #666666; margin: 5px auto; text-align: left">' + 786 '<div style="width: 800px; height: ' + pmheight + 'px; padding: 1px; background: #FFFFFF; border: 1px solid #7597B8; position: relative; left: -6px; top: -3px">' + 787 '<div onmousedown="pmwindrag(event, 1)" onmousemove="pmwindrag(event, 2)" onmouseup="pmwindrag(event, 3)" style="cursor: move; position: relative; left: 0px; top: 0px; width: 800px; height: 30px; margin-bottom: -30px;"></div>' + 788 '<a href="###" onclick="pmwin(\'close\')"><img style="position: absolute; right: 20px; top: 15px" src="images/close.gif" title="å ³é" /></a>' + 789 '<iframe id="pmframe" name="pmframe" style="width:' + pmwidth + 'px;height:100%" allowTransparency="true" frameborder="0"></iframe></div></div>'; 790 } 791 $$('pmlayer').style.display = ''; 792 $$('pmlayer').style.top = ((clientHeight - pmheight) / 2 + scrollTop) + 'px'; 793 if(!param) 794 { 795 pmframe.location = 'pm.php'; 796 } 797 else 798 { 799 pmframe.location = 'pm.php?' + param; 800 } 801 } 802 else if(action == 'close') 803 { 804 for(i = 0;i < objs.length; i ++) 805 { 806 if(objs[i].attributes['oldvisibility']) 807 { 808 objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue; 809 objs[i].removeAttribute('oldvisibility'); 810 } 811 } 812 hiddenobj = new Array(); 813 $$('pmlayer').style.display = 'none'; 814 } 815} 816 817var pmwindragstart = new Array(); 818function pmwindrag(e, op) 819{ 820 if(op == 1) 821 { 822 pmwindragstart = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY]; 823 pmwindragstart[2] = parseInt($$('pmlayer').style.left); 824 pmwindragstart[3] = parseInt($$('pmlayer').style.top); 825 doane(e); 826 } 827 else if(op == 2 && pmwindragstart[0]) 828 { 829 var pmwindragnow = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY]; 830 $$('pmlayer').style.left = (pmwindragstart[2] + pmwindragnow[0] - pmwindragstart[0]) + 'px'; 831 $$('pmlayer').style.top = (pmwindragstart[3] + pmwindragnow[1] - pmwindragstart[1]) + 'px'; 832 doane(e); 833 } 834 else if(op == 3) 835 { 836 pmwindragstart = []; 837 doane(e); 838 } 839} 840 841function doane(event) 842{ 843 e = event ? event : window.event; 844 if(is_ie) 845 { 846 e.returnValue = false; 847 e.cancelBubble = true; 848 } 849 else if(e) 850 { 851 e.stopPropagation(); 852 e.preventDefault(); 853 } 854} 855 856/* * 857 * æ·»å 礼å å°è´ç©è½¦ 858 */ 859function addPackageToCart(packageId) 860{ 861 var package_info = new Object(); 862 var number = 1; 863 864 package_info.package_id = packageId 865 package_info.number = number; 866 867 var str = JSON.stringify(package_info); 868 869 Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' + str, addPackageToCartResponse, 'POST', 'JSON'); 870 871} 872 873/* * 874 * å¤çæ·»å 礼å å°è´ç©è½¦çåé¦ä¿¡æ¯ 875 */ 876function addPackageToCartResponse(result) 877{ 878 if (result.error > 0) 879 { 880 if (result.error == 2) 881 { 882 if (confirm(result.message)) 883 { 884 location.href = 'user.php?act=add_booking&id=' + result.goods_id; 885 } 886 } 887 else 888 { 889 alert(result.message); 890 } 891 } 892 else 893 { 894 var cartInfo = document.getElementById('ECS_CARTINFO'); 895 var cart_url = 'flow.php?step=cart'; 896 if (cartInfo) 897 { 898 cartInfo.innerHTML = result.content; 899 } 900 901 if (result.one_step_buy == '1') 902 { 903 location.href = cart_url; 904 } 905 else 906 { 907 switch(result.confirm_type) 908 { 909 case '1' : 910 if (confirm(result.message)) location.href = cart_url; 911 break; 912 case '2' : 913 if (!confirm(result.message)) location.href = cart_url; 914 break; 915 case '3' : 916 location.href = cart_url; 917 break; 918 default : 919 break; 920 } 921 } 922 } 923} 924 925function setSuitShow(suitId) 926{ 927 var suit = document.getElementById('suit_'+suitId); 928 929 if(suit == null) 930 { 931 return; 932 } 933 if(suit.style.display=='none') 934 { 935 suit.style.display=''; 936 } 937 else 938 { 939 suit.style.display='none'; 940 } 941} 942 943 944/* 以ä¸åä¸ªå½æ°ä¸ºå±æ§éæ©å¼¹åºæ¡çåè½å½æ°é¨å */ 945//æ£æµå±æ¯å¦å·²ç»åå¨ 946function docEle() 947{ 948 return document.getElementById(arguments[0]) || false; 949} 950 951//çæå±æ§éæ©å± 952function openSpeDiv(message, goods_id, parent) 953{ 954 var _id = "speDiv"; 955 var m = "mask"; 956 if (docEle(_id)) document.removeChild(docEle(_id)); 957 if (docEle(m)) document.removeChild(docEle(m)); 958 //计ç®ä¸å·å ç´ å¼ 959 var scrollPos; 960 if (typeof window.pageYOffset != 'undefined') 961 { 962 scrollPos = window.pageYOffset; 963 } 964 else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') 965 { 966 scrollPos = document.documentElement.scrollTop; 967 } 968 else if (typeof document.body != 'undefined') 969 { 970 scrollPos = document.body.scrollTop; 971 } 972 973 var i = 0; 974 var sel_obj = document.getElementsByTagName('select'); 975 while (sel_obj[i]) 976 { 977 sel_obj[i].style.visibility = "hidden"; 978 i++; 979 } 980
981 // æ°æ¿æ´»å¾å± 982 var newDiv = document.createElement("div"); 983 newDiv.id = _id; 984 newDiv.style.position = "absolute"; 985 newDiv.style.zIndex = "10000"; 986 newDiv.style.width = "300px"; 987 newDiv.style.height = "260px"; 988 newDiv.style.top = (parseInt(scrollPos + 200)) + "px"; 989 newDiv.style.left = (parseInt(document.body.offsetWidth) - 200) / 2 + "px"; // å±å¹å± ä¸ 990 newDiv.style.overflow = "auto"; 991 newDiv.style.background = "#FFF"; 992 newDiv.style.border = "3px solid #59B0FF"; 993 newDiv.style.padding = "5px"; 994 995 //çæå±å å 容 996 newDiv.innerHTML = '<h4 style="font-size:14; margin:15 0 0 15;">' + select_spe + "</h4>"; 997 998 for (var spec = 0; spec < message.length; spec++) 999 { 1000 newDiv.innerHTML += '<hr style="color: #EBEBED; height:1px;"><h6 style="text-align:left; background:#ffffff; margin-left:15px;">' + message[spec]['name'] + '</h6>'; 1001 1002 if (message[spec]['attr_type'] == 1) 1003 { 1004 for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++) 1005 { 1006 if (val_arr == 0) 1007 { 1008 newDiv.innerHTML += "<input style='margin-left:15px;' type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' checked /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />'; 1009 } 1010 else 1011 { 1012 newDiv.innerHTML += "<input style='margin-left:15px;' type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />'; 1013 } 1014 } 1015 newDiv.innerHTML += "<input type='hidden' name='spec_list' value='" + val_arr + "' />"; 1016 } 1017 else 1018 { 1019 for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++) 1020 { 1021 newDiv.innerHTML += "<input style='margin-left:15px;' type='checkbox' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + ' [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />'; 1022 } 1023 newDiv.innerHTML += "<input type='hidden' name='spec_list' value='" + val_arr + "' />"; 1024 } 1025 } 1026 newDiv.innerHTML += "<br /><center>[<a href='javascript:submit_div(" + goods_id + "," + parent + ")' class='f6' >" + btn_buy + "</a>] [<a href='javascript:cancel_div()' class='f6' >" + is_cancel + "</a>]</center>"; 1027 document.body.appendChild(newDiv); 1028 1029 1030 // maskå¾å± 1031 var newMask = document.createElement("div"); 1032 newMask.id = m; 1033 newMask.style.position = "absolute"; 1034 newMask.style.zIndex = "9999"; 1035 newMask.style.width = document.body.scrollWidth + "px"; 1036 newMask.style.height = document.body.scrollHeight + "px"; 1037 newMask.style.top = "0px"; 1038 newMask.style.left = "0px"; 1039 newMask.style.background = "#FFF"; 1040 newMask.style.filter = "alpha(opacity=30)"; 1041 newMask.style.opacity = "0.40"; 1042 document.body.appendChild(newMask); 1043} 1044 1045//è·å鿩屿§åï¼å次æäº¤å°è´ç©è½¦ 1046function submit_div(goods_id, parentId) 1047{ 1048 var goods = new Object(); 1049 var spec_arr = new Array(); 1050 var fittings_arr = new Array(); 1051 var number = 1; 1052 var input_arr = document.getElementsByTagName('input'); 1053 var quick = 1; 1054 1055 var spec_arr = new Array(); 1056 var j = 0; 1057 1058 for (i = 0; i < input_arr.length; i ++ ) 1059 { 1060 var prefix = input_arr[i].name.substr(0, 5); 1061 1062 if (prefix == 'spec_' && ( 1063 ((input_arr[i].type == 'radio' || input_arr[i].type == 'checkbox') && input_arr[i].checked))) 1064 { 1065 spec_arr[j] = input_arr[i].value; 1066 j++ ; 1067 } 1068 } 1069 1070 goods.quick = quick; 1071 goods.spec = spec_arr; 1072 goods.goods_id = goods_id; 1073 goods.number = number; 1074 goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId); 1075 1076 Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON'); 1077 1078 document.body.removeChild(docEle('speDiv')); 1079 document.body.removeChild(docEle('mask')); 1080 1081 var i = 0; 1082 var sel_obj = document.getElementsByTagName('select'); 1083 while (sel_obj[i]) 1084 { 1085 sel_obj[i].style.visibility = ""; 1086 i++; 1087 } 1088 1089} 1090 1091// å ³émaskåæ°å¾å± 1092function cancel_div() 1093{ 1094 document.body.removeChild(docEle('speDiv')); 1095 document.body.removeChild(docEle('mask')); 1096 1097 var i = 0; 1098 var sel_obj = document.getElementsByTagName('select'); 1099 while (sel_obj[i]) 1100 { 1101 sel_obj[i].style.visibility = ""; 1102 i++; 1103 } 1104} 1105 1106//å¼¹åºç¡®è®¤æ¡ 1107function popLayer(popTitle,container){ 1108 var fragment = document.createDocumentFragment(), 1109 wrap = document.createElement('div'), 1110 back = document.createElement('div'), 1111 box = document.createElement('div'), 1112 headCont = document.createElement('div'), 1113 h4 = document.createElement('h4'), 1114 span = document.createElement('span'), 1115 popCont = document.createElement('div'); 1116 wrap.className = 'pop-wrap'; 1117 back.className = 'back-layer'; 1118 box.className = 'pop-box'; 1119 headCont.className = 'head-cont'; 1120 span.className = 'close'; 1121 popCont.className = 'pop-cont'; 1122 h4.innerHTML = popTitle; 1123 span.innerHTML = 'x'; 1124 popCont.innerHTML = container; 1125 headCont.appendChild(h4); 1126 headCont.appendChild(span); 1127 box.appendChild(headCont);
1128 box.appendChild(popCont); 1129 wrap.appendChild(back); 1130 wrap.appendChild(box); 1131 fragment.appendChild(wrap); 1132 document.body.appendChild(fragment); 1133 document.querySelector('.close').addEventListener('click',function(){ 1134 document.body.removeChild(wrap) 1135 }) 1136} 1137//æç¤ºæ¡ 1138function popTips(mes,type) { 1139 var type = type || ''; 1140 type == 'suc' ? type = ' success' : type = ' error'; 1141 var newEle = document.createElement('div'); 1142 newEle.className = 'pop-tip' + type; 1143 newEle.innerHTML = mes; 1144 document.body.appendChild(newEle); 1145 setTimeout(function(){ 1146 document.body.removeChild(newEle); 1147 },2500) 1148}
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.