// global var var THEME_URI = 'http://www.bagbrandname.com/store/app/views/themes/cool/'; var OLD_BASE_URI = 'http://static.weloveshopping.com/shop/'; var SHOP_ID = '189600'; var SHOP_NAME = 'ขายกระเป๋าแบรนด์เนม'; var BASE_URI = 'http://www.bagbrandname.com/store'; var JSON_DATA = {"product_on_cart":null}; var SHOP_DISABLED_TEXT = 'y'; var SHOP_DISABLED_MOUSE = 'y'; var SHOP_DISABLED_MOUSE_MSG = 'ลิขสิทธิ์ BagBrandName.com'; var SHOP_PRODUCT_PREVIEW = '1'; var IS_TRANSLATE = true ; var SHOP_POPUP_OPEN = 'n'; var SHOP_POPUP_OPTION = '1,0,1,0,0,0,550,413,500,500'; var SHOP_ADMIN_SHORTCUT = '{"add":["article-block","product-list"],"update":null,"del":null,"manage":null,"showfirst":"1"}'; var SHOP_CLIENT_CART = '2'; var SHOP_CARTMEMBER = 'n'; var MEMBER_MID = 'MEMBER_MID'; var SHOP_COOKIE_NAME = 'cart_cookie189600'; var SHOP_CLIENT_CHAT = '0'; var SITE_URL = 'weloveshopping.com'; var WWW_SITE_URL = 'www.weloveshopping.com'; var YOUSTORE_SITE_URL = 'youstore.weloveshopping.com'; /* ------------------------------- start redir ------------------------------- */ /*var main_url = window.location.href; var is_welove = main_url.indexOf('.weloveshopping.com'); if(is_welove > 0) { if (!getCookie("loadtl")) { setCookie("loadtl",'yes'); rnd = rand_x(1,3); if(rnd == 1) // ------------------------------- edit here ------------------------------- { document.location = 'http://wls.truelife.com/tl_crm.php?url=' + main_url; } } } *//* ------------------------------- end redir ------------------------------- */ if(MEMBER_MID == 'MEMBER_MID') { MEMBER_MID = ''; } base_real = BASE_URI.replace("/store",""); now_url = location.href.replace("/store/home",""); now_url = now_url.replace("/store/",""); popup_option = SHOP_POPUP_OPTION; popup_option = popup_option.split(','); popup_show_type = (typeof popup_option[0] != "undefined") ? popup_option[0] : '1'; //if(now_url==base_real) { if(SHOP_POPUP_OPEN=='y') { if (popup_show_type == '0') { if (now_url == base_real) { window.open('http://www.bagbrandname.com/store/popup/','pop','location=0,directories=0,fullscreen=0,menubar=1,resizable=0,scrollbars=0,toolbar=0,width=550,height=413,left=500,top=500');/* popup zone*/ } } else { window.open('http://www.bagbrandname.com/store/popup/','pop','location=0,directories=0,fullscreen=0,menubar=1,resizable=0,scrollbars=0,toolbar=0,width=550,height=413,left=500,top=500');/* popup zone*/ } } //} function rand_x(l,u) { return Math.floor((Math.random() * (u-l+1))+l); } function setHome() { document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage(BASE_URI); } function addToFavorites() { var fav_title = SHOP_NAME + ' : weloveshopping.com'; if (document.all) window.external.AddFavorite(BASE_URI,fav_title) else if (window.sidebar) window.sidebar.addPanel(fav_title, BASE_URI, ""); // firefox } var popUpWin=0; function popUpWindow(URLStr, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } function Popup(pname,purl,w,h,s){ LeftPosition = (screen.width) ? (screen.width-w-8)/2 : 0; TopPosition = (screen.height) ? (screen.height-h-50)/2 : 0; myWinName = window.open(purl,pname,"width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition+",resizable=no,scrollbars="+s); if (parseInt(navigator.appVersion) >= 4) { myWinName.window.focus(); } return myWinName; } var clock_img = THEME_URI+"../images/icon_clock_2.gif"; $(document).ready(function(){ /*if( (getCookie("uniqueID") == null) || (getCookie("uniqueID") == '') || (typeof(getCookie("uniqueID")) == 'undefined') ) { setCookie("uniqueID",rand (999999)); }*/ $('#caroufredsel').carouFredSel({ auto: true, items: { visible: 3, start: $('#caroufredsel span a img:first') }, scroll: 1, prev: "#prev", next: "#next" }); $('.extraImg').click(function(){ //alert($(this).find('img').html()); var img = $(this).find('img').attr('src'); $('#showFull').hide(); $('#showFull').attr('src',img).fadeIn(); resizeShowImg(); return false; }); if(SHOP_CLIENT_CHAT == 1){ $('#smartchat').show(); }else{ $('#smartchat').hide(); } $('#product-list li[class=pro-item] div[class=pro-desc] a, #product-list li[class=pro-item] div[class=pro-image] a').click(function(){ if($(this).attr('class')!='enlarge') { var firstclick = $.cookie('firstclick'); if(firstclick == null) { $.cookie('firstclick', '1', { path: '/', expires: 1 }); window.open('http://www.weloveshopping.com/crm.php?url=' + $(this).attr('href')); return false; } } }); //poll form check $('#pollFrm').submit(function(){ comment = $(this).find('#comment'); comment_by = $(this).find('#comment_by'); if(comment.val()=='') { alert('กรุณาเลือกผลโหวต และกรอกชื่อผู้ส่ง'); comment.focus(); return false; } if(comment_by.val()=='') { alert('กรุณาเลือกผลโหวต และกรอกชื่อผู้ส่ง'); comment_by.focus(); return false; } }); // pay date $('#timepicker').jtimepicker({ secView:false, minInterval:1, orientation:"horizontal", clockIcon:clock_img, hourLabel:"ชั่วโมง", minLabel:"นาที", hourCombo:"hour", minCombo:"minute" }); $('#paydate').datepicker({ buttonText: 'เลือกวัน' }); // ready queue setMouseMove(); // ยืนยันความเป็นคน setKeyPress(); // ยืนยันความเป็นคน cartIni(); // cart system if (IS_TRANSLATE) { languageIni(); //language system } // end ready queue $("#send").click(function () { var email = $("#email").val(); var newsletter = $('input[name=newsletter]:checked').val(); var uri = OLD_BASE_URI+"s_savemailajax.php"; $.get(uri, { shopid: SHOP_ID, email: email, need: newsletter }, function(data){ alert("e-mail saved."); $("#email").val(''); }); }); /* ======== cartorder/shippingaddress/ =========*/ $('#shipping_address').change(function(){ json_obj = $('#shipping_address :selected').attr('rel'); if(json_obj!='') { json_val = eval(json_obj); $('#name').val(json_val[0].name); $('#address').val(json_val[0].address + ' ' + json_val[0].city); $('#district').val(json_val[0].district); $('#province').val(json_val[0].province); //$('#country').val(json_val[0].country); $('#postcode').val(json_val[0].postcode); $('#contact_tel').val(json_val[0].contact_tel); $('#myemail').val(json_val[0].email); $('#other_info').val(json_val[0].other_info); } }); /* auto */ method_val = $("input[name='shipping_method']:checked").val(); checkMethod(method_val); /* click */ $("input[name='shipping_method']").click(function() { checkMethod($(this).val()); }); /* ======== cartorder/payment/ =========*/ $('input[name=payment_method]').change(function(){ payment_val = $('input[name=payment_method]:checked').val(); if(payment_val == "wetrust") { $(".wetrust").find("input").removeAttr('disabled'); } else if( (payment_val == "BankTrans") || (payment_val == "paysbuy") || (payment_val == "paypal") ) { $(".wetrust").find("input").attr('disabled','disabled'); } }); $('.payment_tips').slideUp(); // init $('input[name=payment_wetrust]').change(function(){ payment_val = $('input[name=payment_wetrust]:checked').val(); detail_wetrust = '#detail_'+payment_val; //alert($('.payment_tips')); $('.payment_tips').slideUp(); $(detail_wetrust).slideDown(); }); // thumb view $('.more_img').click(function(){ el = $(this).attr('src'); $('#main_img').attr('src',el); }); /* ===== shop disable text & mouse =====*/ if(SHOP_DISABLED_MOUSE=='y') { // protect image if($.browser.safari) { $(window).bind('load', function() { $('.pro-image img').protectImage(); }); } else { $(window).bind('load', function() { $('.pro-image img').mask(); }); } if(SHOP_DISABLED_MOUSE_MSG=='') { mouse_msg = 'Right click disabled.'; } else { mouse_msg = SHOP_DISABLED_MOUSE_MSG; } // disable right click $(this).bind("contextmenu", function(e) { alert(mouse_msg); e.preventDefault(); }); } (function($){ var methods = { enable: function() { return $(this) .removeAttr('unselectable') .css({ '-webkit-user-select': 'auto', '-khtml-user-select': 'auto', '-moz-user-select': 'auto', '-o-user-select': 'auto', '-user-select': 'auto' }) .each(function() { this.onselectstart = function() {}; }); }, disable: function() { return $(this) .attr('unselectable', 'on') .css({ '-webkit-user-select': 'none', '-khtml-user-select': 'none', '-moz-user-select': 'none', '-o-user-select': 'none', '-user-select': 'none' }) .each(function() { this.onselectstart = function() { return false; }; }); } }; $.fn.textSelect = function( method ) { // Method calling logic if ( methods[method] ) { return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); } else { console.log( 'Method ' + method + ' does not exist on jQuery.textSelect' ); } } })(jQuery); if(SHOP_DISABLED_TEXT=='y') { $('#container').textSelect('disable'); /*var browser_detect = navigator.userAgent.toLowerCase(); var url_detect = document.URL.toLowerCase(); var disabled_flag = true; if(browser_detect.indexOf('safari') > -1 && url_detect.indexOf('/cartorder/shoppingcart') > -1) { // is safari disabled_flag = false; } if(disabled_flag == true){ // disable text select $("#container").disableTextSelect(); $('#container').bind('click',function() { $("#container").disableTextSelect(); }); $('input, select, textarea').bind('click',function() { $(this).focus(); $("#container").enableTextSelect(); }); }*/ } }); function checkMethod(method_val) { if(method_val==1) { $('#newcontact').find('input').attr('disabled','disabled'); $('#newcontact').find('textarea').attr('disabled','disabled'); //$('#shipping_address').removeAttr('disabled'); } else if(method_val==2) { $('#newcontact').find('input').removeAttr('disabled'); $('#newcontact').find('textarea').removeAttr('disabled'); //$('#shipping_address').attr('disabled','disabled'); } } function checkShipping() { method_val = $("input[name='shipping_method']:checked").val(); if(method_val==1) { temp_val = $("#shipping_address option:selected").attr("rel"); //.val(); $('#db_contact').val(temp_val); } else if(method_val==2) { if(confirm('ต้องการเก็บข้อมูลการจัดส่งสินค้าที่เพิ่มเข้ามาใหม่ไว้ใช้ในครั้งต่อไป?')) { $('#saveContact').val(1); } else { $('#saveContact').val(0); } } } function checkTransport(form) { // transport option transport_option = $('#transport_option :selected').val(); if(transport_option!='#') { form.submit(); return true; } else { alert('โปรดเลือกรูปแบบค่าจัดส่ง'); $('#transport_option').focus(); return false; } } function setMouseMove () { document.onmousemove = function () { if(($.cookie('m'+SHOP_ID)*1)==0) { $.cookie('m'+SHOP_ID,1); } } } function setKeyPress() { document.onkeypress = function () { if(($.cookie('k'+SHOP_ID)*1)==0) { $.cookie('k'+SHOP_ID,1); } } } function summaryCheck(form) { if (typeof setConfirmOrder==="function"){ setConfirmOrder(); } var img = ''; //form.submit(); $.blockUI({ theme: true, title: 'ข้อความจากระบบ', message: img + '

ประมวลผลข้อมูล กรุณารอสักครู่...
Please wait, Processing data ...
โปรดอย่ากดปุ่มใดๆ จนกว่าหน้าจอการสั่งซื้อจะสิ้นสุด

' }); return false; } //** Site Logo/ Watermark Script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. //** Available/ usage terms at http://www.dynamicdrive.com //** v2.0 (April 19th, 09') var ddsitelogo={ setting: {orientation:4, visibleduration:0, fadeduration:[1000, 500]}, //orientation=1|2|3|4, duration=millisec or 0, fadedurations=millisecs offsets: {x:10, y:10},//offset of logo relative to window corner logoHTML: '', //HTML for logo, which is auto wrapped in DIV w/ ID="mysitelogo" coord: {}, keepfixed:function(){ if (!this.cssfixedsupport){ var $window=jQuery(window) var is1or3=/^[13]$/.test(this.setting.orientation) var is1or2=/^[12]$/.test(this.setting.orientation) var x=$window.scrollLeft() + (is1or3? this.offsets.x : $window.width()-this.$control.width()-this.offsets.x) var y=$window.scrollTop() + (is1or2? this.offsets.y : $window.height()-this.$control.height()-this.offsets.y) this.$control.css({left:x+'px', top:y+'px'}) } }, showlogo:function(){ var mainobj=ddsitelogo this.$control.animate({opacity:1}, this.setting.fadeduration[0]) if (this.setting.visibleduration>0){ setTimeout(function(){ mainobj.$control.stop().animate({opacity:0}, mainobj.setting.fadeduration[1], function(){ jQuery(window).unbind('scroll.fixed resize.fixed') }) }, this.setting.visibleduration+this.setting.fadeduration[0]) } }, init:function(){ jQuery(document).ready(function($){ var mainobj=ddsitelogo var iebrws=document.all mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode if (mainobj.cssfixedsupport){ mainobj.coord[(/^[13]$/.test(mainobj.setting.orientation))? 'left' : 'right']=mainobj.offsets.x mainobj.coord[(/^[12]$/.test(mainobj.setting.orientation))? 'top' : 'bottom']=mainobj.offsets.y } mainobj.$control=$('') .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', opacity:0}) .css(mainobj.coord) .appendTo('body') if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text mainobj.keepfixed() mainobj.showlogo() $(window).bind('scroll.fixed resize.fixed', function(){mainobj.keepfixed()}) }) } } if (SHOP_CLIENT_CHAT == 1) { ddsitelogo.init() } function setCookie(name, value, expires, path, domain, secure) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } function rand ( n ) { return ( Math.floor ( Math.random ( ) * n + 1 ) ); } document.onkeyup = function () { setCookie('robocop','bigchern'); }; document.onmousemove = function () { setCookie('robocop','bigchern'); };