// global var var THEME_URI = 'http://www.siraromgems.com/store/app/views/themes/2column/'; var OLD_BASE_URI = 'http://static.weloveshopping.com/shop/'; var SHOP_ID = '116707'; var SHOP_NAME = 'siraromgems'; var BASE_URI = 'http://www.siraromgems.com/store'; var JSON_DATA = {"product_on_cart":null}; var SHOP_DISABLED_TEXT = 'y'; var SHOP_DISABLED_MOUSE = 'y'; var SHOP_DISABLED_MOUSE_MSG = ''; var SHOP_PRODUCT_PREVIEW = '1'; var IS_TRANSLATE = true ; var SHOP_POPUP_OPEN = ''; var SHOP_POPUP_OPTION = '0,0,0,0,0,0,250,150,10,110'; var SHOP_ADMIN_SHORTCUT = '{"add":["article-block"],"update":null,"del":null,"manage":null,"showfirst":null}'; var SHOP_CLIENT_CART = '2'; var SHOP_CARTMEMBER = ''; var MEMBER_MID = 'MEMBER_MID'; var SHOP_COOKIE_NAME = 'cart_cookie116707'; if(MEMBER_MID == 'MEMBER_MID') { MEMBER_MID = ''; } base_real = BASE_URI.replace("store",""); if(location.href==base_real) { if(SHOP_POPUP_OPEN=='y') { window.open('http://www.siraromgems.com/store/popup/','pop','location=0,directories=0,fullscreen=0,menubar=0,resizable=0,scrollbars=0,toolbar=0,width=250,height=150,left=10,top=110');/* popup zone*/ } } 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(){ $('#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'); json_val = eval(json_obj); $('#name').val(json_val[0].name); $('#address').val(json_val[0].address); $('#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); $('#email').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(); }); } if(SHOP_DISABLED_TEXT=='y') { // 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) { var img = ''; //form.submit(); $.blockUI({ theme: true, title: 'ข้อความจากระบบ', message: img + '

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

' }); return false; }