assistance = { showass: function(sender) { $('#assPop .mid').css('height', 'auto'); var xy = this.findPosXY(sender); var leftVal = xy[0] + $(sender).width() + "px"; var topVal = xy[1] - ($('#assPop').height() - 5) + "px"; if ($.browser.msie) { $('#assPop').css({left:leftVal, top:topVal}).show(); } else { $('#assPop').css({left:leftVal, top:topVal}).fadeIn(300); } }, close: function() { if ($.browser.msie) { $('#assPop').hide(); } else { $('#assPop').fadeOut(300); } }, findPosXY: function (obj) { var curleft = 0; var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.x) { curleft += obj.x; curtop += obj.y; } return new Array(curleft,curtop); } }; /** * @author Alexandre Magno * @desc Center a element with jQuery * @version 1.0 * @example * $("element").center({ * * vertical: true, * horizontal: true * * }); * @obs With no arguments, the default is above * @license free * @param bool vertical, bool horizontal * @contribution Paulo Radichi * */ jQuery.fn.center = function(params) { var options = { vertical: true, horizontal: true }; op = jQuery.extend(options, params); return this.each(function(){ //initializing variables var $self = jQuery(this); //get the dimensions using dimensions plugin var width = $self.width(); var height = $self.height(); //get the paddings var paddingTop = parseInt($self.css("padding-top")); var paddingBottom = parseInt($self.css("padding-bottom")); //get the borders var borderTop = parseInt($self.css("border-top-width")); var borderBottom = parseInt($self.css("border-bottom-width")); //get the media of padding and borders var mediaBorder = (borderTop+borderBottom)/2; var mediaPadding = (paddingTop+paddingBottom)/2; //get the type of positioning var positionType = $self.parent().css("position"); // get the half minus of width and height var halfWidth = (width/2)*(-1); var halfHeight = ((height/2)*(-1))-mediaPadding-mediaBorder; // initializing the css properties var cssProp = { position: 'absolute' }; if(op.vertical) { cssProp.height = height; cssProp.top = '50%'; cssProp.marginTop = halfHeight; } if(op.horizontal) { cssProp.width = width; cssProp.left = '50%'; cssProp.marginLeft = halfWidth; } //check the current position if(positionType == 'static') { $self.parent().css("position","relative"); } //aplying the css $self.css(cssProp); }); }; /* * jQuery Color Animations * Copyright 2007 John Resig * Released under the MIT and GPL licenses. */ (function(jQuery){ // We override the animation for all of these color styles jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ jQuery.fx.step[attr] = function(fx){ if ( fx.state == 0 ) { fx.start = getColor( fx.elem, attr ); fx.end = getRGB( fx.end ); } fx.elem.style[attr] = "rgb(" + [ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) ].join(",") + ")"; } }); // Color Conversion functions from highlightFade // By Blair Mitchelmore // http://jquery.offput.ca/highlightFade/ // Parse strings looking for color tuples [255,255,255] function getRGB(color) { var result; // Check if we're already dealing with an array of colors if ( color && color.constructor == Array && color.length == 3 ) return color; // Look for rgb(num,num,num) if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; // Look for rgb(num%,num%,num%) if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; // Look for #a0b1c2 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; // Look for #fff if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; // Otherwise, we're most likely dealing with a named color return colors[jQuery.trim(color).toLowerCase()]; }; function getColor(elem, attr) { var color; do { color = jQuery.curCSS(elem, attr); // Keep going until we find an element that has color, or we hit the body if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) break; attr = "backgroundColor"; } while ( elem = elem.parentNode ); return getRGB(color); }; // Some named colors to work with // From Interface by Stefan Petre // http://interface.eyecon.ro/ var colors = { aqua:[0,255,255], azure:[240,255,255], beige:[245,245,220], black:[0,0,0], blue:[0,0,255], brown:[165,42,42], cyan:[0,255,255], darkblue:[0,0,139], darkcyan:[0,139,139], darkgrey:[169,169,169], darkgreen:[0,100,0], darkkhaki:[189,183,107], darkmagenta:[139,0,139], darkolivegreen:[85,107,47], darkorange:[255,140,0], darkorchid:[153,50,204], darkred:[139,0,0], darksalmon:[233,150,122], darkviolet:[148,0,211], fuchsia:[255,0,255], gold:[255,215,0], green:[0,128,0], indigo:[75,0,130], khaki:[240,230,140], lightblue:[173,216,230], lightcyan:[224,255,255], lightgreen:[144,238,144], lightgrey:[211,211,211], lightpink:[255,182,193], lightyellow:[255,255,224], lime:[0,255,0], magenta:[255,0,255], maroon:[128,0,0], navy:[0,0,128], olive:[128,128,0], orange:[255,165,0], pink:[255,192,203], purple:[128,0,128], violet:[128,0,128], red:[255,0,0], silver:[192,192,192], white:[255,255,255], yellow:[255,255,0] }; })(jQuery); (function(jQuery){jQuery.fn.__bind__=jQuery.fn.bind;jQuery.fn.__unbind__=jQuery.fn.unbind;jQuery.fn.__find__=jQuery.fn.find;var hotkeys={version:'0.7.9',override:/keypress|keydown|keyup/g,triggersMap:{},specialKeys:{27:'esc',9:'tab',32:'space',13:'return',8:'backspace',145:'scroll',20:'capslock',144:'numlock',19:'pause',45:'insert',36:'home',46:'del',35:'end',33:'pageup',34:'pagedown',37:'left',38:'up',39:'right',40:'down',109:'-',112:'f1',113:'f2',114:'f3',115:'f4',116:'f5',117:'f6',118:'f7',119:'f8',120:'f9',121:'f10',122:'f11',123:'f12',191:'/'},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":"\"",",":"<",".":">","/":"?","\\":"|"},newTrigger:function(type,combi,callback){var result={};result[type]={};result[type][combi]={cb:callback,disableInInput:false};return result;}};hotkeys.specialKeys=jQuery.extend(hotkeys.specialKeys,{96:'0',97:'1',98:'2',99:'3',100:'4',101:'5',102:'6',103:'7',104:'8',105:'9',106:'*',107:'+',109:'-',110:'.',111:'/'});jQuery.fn.find=function(selector){this.query=selector;return jQuery.fn.__find__.apply(this,arguments);};jQuery.fn.unbind=function(type,combi,fn){if(jQuery.isFunction(combi)){fn=combi;combi=null;} if(combi&&typeof combi==='string'){var selectorId=((this.prevObject&&this.prevObject.query)||(this[0].id&&this[0].id)||this[0]).toString();var hkTypes=type.split(' ');for(var x=0;x'); }); jQuery.fn.swap = function(b) { b = jQuery(b)[0]; var a = this[0]; var t = a.parentNode.insertBefore(document.createTextNode(''), a); b.parentNode.insertBefore(a, b); t.parentNode.insertBefore(b, t); t.parentNode.removeChild(t); return this; }; dsearch = { chcountry: function(sender) { if ($(sender).val() != 0) { $.post('/modules/mod_Dsearch.php', { getCitiesOptions: $(sender).val() }, function (data) { $('#city').attr('disabled', false); $('#city').html(data); }); } else { $('#city').attr('disabled', 'disabled'); $('#city').html(''); } $('#dresults').html(''); }, chcity: function(sender, page) { var cityid = typeof(sender) == 'object' ? $(sender).val() : sender; if (cityid != 0) { $.post('/modules/mod_Dsearch.php', { getDealers: cityid, page: page }, function (data) { $('#dresults').html(data); }); } else { $('#dresults').html(''); } } }; $('document').ready(function() { // a bit hardcoded stuff if (global.pid == 11) { // open, close galleries $('#gallerList .head').click(function() { if ($(this).nextAll('ul').css('display') == 'block') return false; $('#gallerList ul:visible').animate({height:'0px'}, 300, '', function() {$('#gallerList ul:visible').hide()} ); $(this).nextAll('ul').animate({height: (Math.ceil(($(this).nextAll('ul').children('li').length) / 2) * 90) + 'px'}, 1000); // open first image if ($(this).nextAll('ul').children('li:first').length > 0) { $(this).nextAll('ul').children('li:first').children('a').click(); } else { $('#openPic img').attr('src', '/images/1px.gif'); $('#openPic h3.title').html(''); $('#openPic div.text').html(''); $('#editGalleryCont, #permlinkCont').css('display', 'none'); } return false; }); // open first gallery, if all closed if ($('#gallerList ul:visible').length == 0) { $('#gallerList .head:first').nextAll('ul').css({'height':'auto', 'display':'block'}); } // select permlink $('#picPermlink').focus(function() { this.select(); }); $('#picPermlink').click(function() { this.select(); }); // next pic function $('#nextPic').click(function() { $('#gallerList ul:visible li.sel').next('li').children('a').click(); }); // prev pic function $('#prevPic').click(function() { $('#gallerList ul:visible li.sel').prev('li').children('a').click(); }); // if randomized gallery if ($('#gallerList ul:visible li.sel').length == 0) { $('#gallerList ul:visible li:first').addClass('sel'); } // initialize next prev links $('#nextPic').css('display', ($('#gallerList ul:visible li.sel').next('li').length > 0 ? 'block' : 'none')); $('#prevPic').css('display', ($('#gallerList ul:visible li.sel').prev('li').length > 0 ? 'block' : 'none')); // animate image $('#openPic img').load(function() { $('.navCont').animate({width: $('#openPic img').width() + 'px', height: $('#openPic img').height() + 'px', opacity: 1}, 350); }); // assign shortcuts gallery.assignHotkeys(); } }); gallery = { getPict: function(sender, id) { $.post('/modules/mod_Gallery.php', { getPict: id }, function (data) { $('#gallerList ul:visible li').removeClass('sel'); $(sender).parent().addClass('sel'); $('.navCont').animate({'opacity': '0'}, 150, '', function () { $('#openPic img').attr('src', data.image); $('#openPic h3.title').html(data.title); $('#openPic div.text').html(data.dtext); $('#picPermlink').val(data.permlink); if ($('#editOpenPic').length > 0) { $('#editOpenPic').get(0).onclick = ''; $('#deleteOpenPic').get(0).onclick = ''; $('#editOpenPic').unbind('click').click(function() { galleryAdm.getPictForm(id); }); $('#deleteOpenPic').unbind('click').click(function() { galleryAdm.delPict(id); }); } $('#permlinkCont, #editGalleryCont').css('display', 'block'); // next prev links $('#nextPic').css('display', ($('#gallerList ul:visible li.sel').next('li').length > 0 ? 'block' : 'none')); $('#prevPic').css('display', ($('#gallerList ul:visible li.sel').prev('li').length > 0 ? 'block' : 'none')); // try to cache next prev img if ($('#gallerList ul:visible li.sel').next('li').length > 0) { var imgCachePrev = new Image(); imgCachePrev.src = $('#gallerList ul:visible li.sel').next('li').children('a').children('img').attr('src').replace('_t.', '.'); } if ($('#gallerList ul:visible li.sel').prev('li').length > 0) { var imgCacheNext = new Image(); imgCacheNext.src = $('#gallerList ul:visible li.sel').prev('li').children('a').children('img').attr('src').replace('_t.', '.'); } }); }, 'json'); return false; }, sortAZ: function(sender) { $(".sortLinks a").removeClass(); $(sender).addClass('active'); var flag = true; while (flag) { flag = false; $('#gallerList > li').each(function() { if ($(this).next('li').length > 0) { // get gallery title var currval = $(this).children('a:first').text(); var nextval = $(this).next('li').children('a:first').text(); if (nextval < currval) { $(this).swap($(this).next('li')); flag = true; } } }); } }, sortNewest: function(sender) { $(".sortLinks a").removeClass(); $(sender).addClass('active'); var flag = true; while (flag) { flag = false; $('#gallerList > li').each(function() { if ($(this).next('li').length > 0) { // get gallery id var currval = parseInt($(this).children('ul').attr('id').replace('gal_', '')); var nextval = parseInt($(this).next('li').children('ul').attr('id').replace('gal_', '')); if (nextval > currval) { $(this).swap($(this).next('li')); flag = true; } } }); } }, sortRandom: function(sender) { $(".sortLinks a").removeClass(); $(sender).addClass('active'); var galcnt = $('#gallerList > li').length; if (galcnt > 0) { for (var n = 0; n < 15; n++) { $('#gallerList > li').each(function() { if ($(this).next('li').length > 0) { // random if (Math.ceil(2 * Math.random()-1)) { $(this).swap($(this).next('li')); } } }); } } }, assignHotkeys: function() { $(document).bind('keydown', 'p', function() { $('#prevPic').click(); } ); $(document).bind('keydown', 'n', function() { $('#nextPic').click(); } ); } }; news = { open: function(id) { $.post('/modules/mod_News.php', { openNews: id }, function(data) { $('#news-middle').html(data.doc); $('#newsRightText').html(data.text2); }, "json"); return false; }, page: function(num) { $.post('/modules/mod_News.php', { getHlines: num }, function(data) { $('.headlines').replaceWith(data.hlines); $('#newspages').html(data.pages); }, "json"); return false; } }; $('document').ready(function() { $('#estiType').change(function() { if ($(this).val() == 'car') { $('#olyacht').css('display', 'none'); $('#olcar').css('display', 'block'); quoteme.calcCPrice(); } else { $('#olyacht').css('display', 'block'); $('#olcar').css('display', 'none'); quoteme.calcYPrice(); } }); $('#cpaint, #csize').change(function() { quoteme.calcCPrice() }); $('#ylength').keyup(function() { quoteme.calcYPrice() }); $('#ytype, #ypaint').change(function() { quoteme.calcYPrice() }); if ($('#bdate').length > 0) { $('#bdate').datepicker(); $('#bdate').datepicker('option', 'firstDay', 1); $('#bdate').datepicker('option', 'minDate', 0); $('#bdate').datepicker('option', 'showAnim', 'slideDown'); } }); quoteme = { calcCPrice: function() { if ($('#cpaint').val() != 0 && $('#csize').val() != 0) { $.post('/modules/mod_Quoteme.php', { getCPrice: $('#cpaint').val(), size: $('#csize').val() }, function (data) { $('#estimateTotal').html(data); $('#estTotal').css('display', 'block'); }); } else { $('#estTotal').css('display', 'none'); } }, calcYPrice: function() { if (/^\d+$/.test($('#ylength').val()) && $('#ytype').val() != '0' && $('#ypaint').val() != '0') { var total = Math.round($('#ylength').val() * $('#ytype').val() * $('#ypaint').val()); $('#estimateTotal').html(total); $('#estTotal').css('display', 'block'); } else { $('#estTotal').css('display', 'none'); } }, booking: function() { // submit stuff if ($('#bdate').val() == '' || $('#bname').val() == '' || $('#bphone').val() == '' || $('#bemail').val() == '') { alert('Please fill in all required fields (*).'); } else { if ($('#binc').is(':checked')) { // include form if ($('#estiType').val() == 'car') { if ($('#cpaint').val() == '0' || $('#csize').val() == '0') { alert('Please fill in all required fields (*).'); return; } var details = [$('#cmake').val(), $('#cmodel').val(), $('#cyear :selected').text(), $('#ccolor').val(), $('#cpaint :selected').text(), $('#csize :selected').text()]; } else { if ($('#ylength').val() == '' || $('#ytype').val() == '0' || $('#ypaint').val() == '0') { alert('Please fill in all required fields (*).'); return; } var details = [$('#ylength').val(), $('#ytype :selected').text(), $('#ypaint :selected').text()]; } var details_json = $.toJSON(details); $.post('/modules/mod_Quoteme.php', { booking: $('#bdate').val(), name: $('#bname').val(), phone: $('#bphone').val(), email: $('#bemail').val(), details: details_json }, function () { window.location.reload(); }); } else { $.post('/modules/mod_Quoteme.php', { booking: $('#bdate').val(), name: $('#bname').val(), phone: $('#bphone').val(), email: $('#bemail').val() }, function () { window.location.reload(); }); } } } }; rescentre = { /*getfiles: function(sender, pid) { $.post('/modules/mod_Rescentre.php', { getSect: pid }, function(data) { $('#resFiles').html(data); if ($('#resAddLink').length > 0) { $('#resAddLink').get(0).onclick = function() {}; // remove default click $('#resAddLink').unbind('click').click(function () { rescentreAdm.getForm(pid); }); $('#resAddLink').css('display', 'block'); } if ($('#resIntroText').length > 0) $('#resIntroText').css('display', 'none'); // set classes $('.resMenu .active').removeClass('active'); $(sender).closest('li').addClass('active'); // set open section title if ($(sender).parent().parent().is('.resMenu')) { $('#filesSubTitle').html($(sender).text()); } else { $('#filesSubTitle').html($(sender).parent().parent().siblings('.open').text()); } }); return false; },*/ opencloseCat: function(sender) { if ($(sender).hasClass('open2')) { $(sender).removeClass().addClass('close2').next('ul').hide(); $(sender).prev().removeClass('active'); } else { $(sender).removeClass().addClass('open2').next('ul').show(); $(sender).prev().addClass('active'); } } }; /*$('document').ready(function() { // open/close menu $("#resMenu .open, #resMenu .close").click(function(){ if ($(this).is('.open')) { $(this).removeClass('open').addClass('close'); $(this).siblings('ul').css('display', 'none'); } else { $(this).removeClass('close').addClass('open'); $(this).siblings('ul').css('display', 'block'); $(this).siblings('ul').children('li').children('a:first').click(); } return false; }); $("#resMenu .open, #resMenu .close").click(function() { $(this).removeClass('close').addClass('open'); $(this).siblings('ul').css('display', 'block'); $(this).siblings('ul').children('li').children('a:first').click(); $(this).next('a').removeClass().addClass('open2'); return false; }); });*/ $('document').ready(function() { $('.links .minus').click(function() { var val = $(this).next('input').val(); if (val > 1) $(this).next('input').val(--val); }); $('.links .plus').click(function() { var val = $(this).prev('input').val(); if (val < 99) $(this).prev('input').val(++val); }); $('.links input[type="text"]').keyup(function() { $(this).val($(this).val().replace(/[^\d]/g,'')); }); $('#prod_size').change(function() { $('#prod_price').html(pprices[$(this).val()][0].toFixed(2)); $('#prod_stock').html(pprices[$(this).val()][1] == 1 ? 'In stock' : 'Out of stock'); $('#prod_pricevat').html(pprices[$(this).val()][2].toFixed(2)); }); // "Search" for search input $('#search').focus(function() { if ($(this).val() == 'Search') $(this).val(''); }); $('#search').blur(function() { if ($(this).val() == '') $(this).val('Search'); }); // register .. phone info $("#regPhoneInfo").bind("mouseenter",function(){ shopAss.showass(this); }).bind("mouseleave",function(){ shopAss.close(this); }); // login - focus email field $('.loginForm #email').focus(); // register - focus first field $('.forma #nname').focus(); }); shopAss = { // register [phone info] showass: function(sender) { $('#assPop2 .mid').css('height', 'auto'); var xy = this.findPosXY(sender); var leftVal = '135px'; var topVal = xy[1] - ($('#assPop2').height() - 5 + 315) + "px"; if ($.browser.msie) { $('#assPop2').css({left:leftVal, top:topVal}).show(); } else { $('#assPop2').css({left:leftVal, top:topVal}).fadeIn(300); } }, close: function() { if ($.browser.msie) { $('#assPop2').hide(); } else { $('#assPop2').fadeOut(300); } }, findPosXY: function (obj) { var curleft = 0; var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.x) { curleft += obj.x; curtop += obj.y; } return new Array(curleft,curtop); }, // out of stock msg showass2: function(sender) { $('#assPop3 .mid').css('height', 'auto'); $('#assPop3').appendTo('body'); var xy = this.findPosXY(sender); var leftVal = xy[0] + $(sender).width() + "px"; var topVal = xy[1] - ($('#assPop3').height() - 5) + "px"; if ($.browser.msie) { $('#assPop3').css({left:leftVal, top:topVal}).show(); } else { $('#assPop3').css({left:leftVal, top:topVal}).fadeIn(300); } }, close2: function() { if ($.browser.msie) { $('#assPop3').hide(); } else { $('#assPop3').fadeOut(300); } }, // inquire msg showass3: function(sender) { $('#assPop4 .mid').css('height', 'auto'); $('#assPop4').appendTo('body'); var xy = this.findPosXY(sender); var leftVal = xy[0] + $(sender).width() + "px"; var topVal = xy[1] - ($('#assPop4').height() - 5) + "px"; if ($.browser.msie) { $('#assPop4').css({left:leftVal, top:topVal}).show(); } else { $('#assPop4').css({left:leftVal, top:topVal}).fadeIn(300); } }, close3: function() { if ($.browser.msie) { $('#assPop4').hide(); } else { $('#assPop4').fadeOut(300); } } }; shop = { openTab: function(sender, tabid, prodid) { $('#ptab .t ul li').removeClass('active'); switch(tabid) { case 1: $.post('/modules/mod_Shop.php', { getProdFullDescr: prodid }, function (data) { $('#ptab .mid').html(data); $(sender).parent().addClass('active'); }); break; case 2: $.post('/modules/mod_Shop.php', { getResources: prodid }, function (data) { $('#ptab .mid').html(data); $(sender).parent().addClass('active'); }); break; } }, validateRegister: function(edit) { if ($.trim($('#nname').val()) == '') { alert('please fill name'); $('#nname').focus(); return false; } if ($.trim($('#surname').val()) == '') { alert('please fill surname'); $('#surname').focus(); return false; } if ($.trim($('#email').val()) == '') { alert('please fill email'); $('#email').focus(); return false; } if (edit != 'edit') if ($.trim($('#password').val()) == '') { alert('please fill password'); $('#password').focus(); return false; } if ($('#password').val() != $('#password2').val() ) { alert('passwords doesnt\'t match'); return false; } if ($.trim($('#address1').val()) == '') { alert('please fill address'); $('#address1').focus(); return false; } if ($.trim($('#city').val()) == '') { alert('please fill city'); $('#city').focus(); return false; } if ($.trim($('#region').val()) == '') { alert('please fill region'); $('#region').focus(); return false; } if ($.trim($('#zip').val()) == '') { alert('please fill zip'); $('#zip').focus(); return false; } if (shop.emailExists($('#email').val()) == 1) { $('#error-email-div').show(); $('#email').select(); return false; } else { return true; } }, emailExists: function(email) { return (function () { var val = null; $.ajax({ 'type': 'POST', 'async': false, 'data': ({ 'emailExists': email }), 'url': '/modules/mod_Shop.php', 'success': function (data) { val = data; } }); return val; })(); }, addToBasket: function(sender, prodid) { // check stock if ($('#prod_stock').length > 0 && $('#prod_stock').html().indexOf('Out') != -1) { shopAss.showass2(sender); } else { $.post('/modules/mod_Shop.php', { checkStock: prodid }, function (data) { if (data == 0) { shopAss.showass2(sender); } else { $.post('/modules/mod_Shop.php', { addToBasket: prodid, qty: $(sender).prevAll('input:first').val(), size: $('#prod_size').length > 0 ? $('#prod_size').val() : 0 }, function (data) { if (data.error == 0) { $('#totsum').html(data.value.toFixed(2)); $('#basketanimbg').css('opacity', 1); $('#basketanimbg').animate({opacity: 0}, 500); } else { alert(data.value); } }, 'json'); } }); } }, removeFromBasket: function(priceid) { if (!confirm('Are you sure want to remove this item from basket?')) { return; } $.post('/modules/mod_Shop.php', { removeFromBasket: priceid }, function () { window.location.reload(); }); }, updateBasket: function() { var basket = Array(); var n = 0; $('#basketTable input').each(function(i, obj) { basket[n] = [obj.id.replace('bid_', ''), obj.value]; n++; }); $.post('/modules/mod_Shop.php', { updateBasket: $.toJSON(basket) }, function () { window.location.reload(); }); }, search: function() { $.post('/modules/mod_Shop.php', { search: $('#search').val() }, function (data) { $('#shopRColumn').html(data); if ($('.shopTitle').length > 0) { $('.shopTitle').html('Search results'); } else { $('.shopBreadcrumb').replaceWith('

Search results

'); } }); }, opencloseCat: function(sender) { if ($(sender).hasClass('open')) { $(sender).removeClass().addClass('close').next('ul').hide(); $(sender).prev().removeClass('active'); } else { $(sender).removeClass().addClass('open').next('ul').show(); $(sender).prev().addClass('active'); } }, loadOH: function(ohid) { $.post('/modules/mod_Shop.php', { loadOH: ohid }, function (data) { $('#totsum').html(data); alert('loading done'); }); }, delOH: function(ohid) { if (!confirm('Are you sure want to delete?')) { return; } $.post('/modules/mod_Shop.php', { delOH: ohid }, function (data) { window.location.href = data; }); }, saveBasket: function() { $.post('/modules/mod_Shop.php', { saveBasket: 0 }, function () { alert('saved'); }); }, setCountry: function(sender) { $.post('/modules/mod_Shop.php', { setCountry: $(sender).val() }, function () { window.location.reload(); }); }, setOption: function(sender) { $.post('/modules/mod_Shop.php', { setOption: $(sender).val() }, function () { window.location.reload(); }); }, setWOption: function(sender) { $.post('/modules/mod_Shop.php', { setWOption: $(sender).val() }, function () { window.location.reload(); }); }, checkoutClick: function(sender, url) { if ($(sender).hasClass('inactive')) { alert('please choose shipping information or contact office'); } else { window.location.href = url; } } }; $('document').ready(function() { video.initNextPrev(); }); video = { showimg: 3, pg: 0, next: function() { this.pg++; var left = this.pg * -311; this.initNextPrev(); $('.videos').animate({'left': left + 'px'}, 1600); }, prev: function() { this.pg--; var left = this.pg * -311; this.initNextPrev(); $('.videos').animate({'left': left + 'px'}, 1600); }, initNextPrev: function() { $('.video-nav .prev').css('visibility', (this.pg > 0 ? 'visible' : 'hidden') ); $('.video-nav .next').css('visibility', ($('.videos li').length <= ((this.pg + 1) * this.showimg) ? 'hidden' : 'visible' ) ); $('.video-nav .middle').css('visibility', ($('.videos li').length <= this.showimg ? 'hidden' : 'visible') ); }, getVideo: function(sender, id) { $.post('/modules/mod_Video.php', { getVideo: id }, function (data) { $('#videoTitle').html(data.title); $('#openVideo').html(data.video); $('.videos > li').removeClass('selected'); $(sender).parent().addClass('selected'); }, 'json'); } };