var BU='http://www.prestigecy.com/'; //JCarouselLite (function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery); $(document).ready(function(){ $.each($('.datevalue'), function(){ $(this).datepicker({ showOn: "button", buttonImage: BU+"site/images/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy', defaultDate: $(this).attr('defaultDate')?$(this).attr('defaultDate'):null, yearRange: $(this).attr('yearRange')?$(this).attr('yearRange'):'c-10:c+10' }); }); $('#intronav > #btn_next').click(function(){ x=$('.mainCars > li.on'); y=x.next(); if(y.length==0) y=x.parent().children(':first-child'); if(x[0]!=y[0]) { x.hide().removeClass('on'); y.show().addClass('on'); } return false; }); $('#intronav > #btn_prev').click(function(){ x=$('.mainCars > li.on'); y=x.prev(); if(y.length==0) y=x.parent().children(':last-child'); if(x[0]!=y[0]) { x.hide().removeClass('on'); y.show().addClass('on'); } return false; }); /*$('#sidenav>ul>li>a').click(function(){ x=$('#sidenav>ul>li.active'); y=$(this).parent(); if(x.length>0) { $('#sidenav>ul>li.active>ul').hide('slow'); x.removeClass('active'); } if(x.attr('id')!=y.attr('id') || x.length==0) { y.addClass('active'); $('#sidenav>ul>li.active>ul').show('slow'); } });*/ $('.mainImg').click(function(){ $('.photogalholder').hide('slow'); $('#'+$(this).attr('rel')).show('slow'); $('#carList li.active').removeClass('active'); $(this).parent().addClass('active'); $('.modalImg').dialog({ autoOpen: false, modal:true, width:'auto' }); }); $(".jCarouselLite").jCarouselLite({ btnNext: ".next", btnPrev: ".prev" }); $(".bottomCarousel").jCarouselLite({ auto: 800, speed: 6500, visible: 1 }); $(".clearOnClick").click(function(){$(this).val('');}); $(".selOnClick").click(function(){$(this).select();}); $.each($('.photogalholderTable'), function() { $('a.lightBox',$(this)).lightBox(); }); }); function sendMail(name, mail, txt) { var mailPattern=/^[a-zA-Z0-9_]+@[a-zA-Z0-9_]+\.[a-zA-Z0-9_]+$/ if(!name || !txt || !mailPattern.test(mail)) { alert('Wrong or incomplete data!'); return false; } $.ajax({ type: "POST", url: BU+"site/sendMail.php", data: "name="+name+"&from="+mail+"&msg="+txt, success: function(msg){ alert(msg); $('#enq_name').val('Name:'); $('#enq_mail').val('Email:'); $('#enq_msg').val('Message:'); } }); return true; } function validateQuoteForm() { obj=$('#quote_loc_from'); if(obj[0].selectedIndex==0) { alert('Please select a pickup location'); obj.focus(); return false; } obj=$('#quote_loc_to'); if(obj[0].selectedIndex==0) { alert('Please select a return location'); obj.focus(); return false; } if(!$('#quote_box').attr('checked')) { alert('You must be over 25!'); return false; } obj1=$('#quote_from'); if(obj1.val()=='') { alert('Please select a pickup date'); obj1.focus(); return false; } obj2=$('#quote_to'); if(obj2.val()=='') { alert('Please select a return date'); obj2.focus(); return false; } obj1Date=new Date(obj1.val()); todayDate=new Date(); if(obj1Date=obj2Date) { alert('The return date should not be prior to the Pickup date'); obj2.focus(); return false; } var one_day=1000*60*60*24; if(obj2Date.getTime()-obj1Date.getTime()<3*one_day) { alert('Number of days for booking must be 3 or more'); obj2.focus(); return false; } return true; } function checkDates(dt1,dt2) { var d1,d2,m1,m2,y1,y2,dd,md,yd; y1=dt1.getFullYear(); y2=dt2.getFullYear(); yd=y1-y2; m1=dt1.getMonth(); m2=dt2.getMonth(); md=m1-m2; d1=dt1.getDate(); d2=dt2.getDate(); dd=d1-d2; if(yd<25) return false; if(yd>25) return true; if(md<0) return false; if(md>0) return true; if(dd<0) return false; return true; } function validateOrderForm() { obj=$('#txtdob'); if(obj.val()=='') { alert('Date of birth error'); obj.focus(); return false; } objDate=new Date(obj.val()); todayDate=new Date(); if(!checkDates(todayDate,objDate)) { alert('You must be over 25!'); obj.focus(); return false; } obj=$('#txtName'); if(obj.val()=='') { alert('Name error'); obj.focus(); return false; } obj=$('#txtsurename'); if(obj.val()=='') { alert('Surname error'); obj.focus(); return false; } obj=$('#txtEmail'); expr=/^[a-zA-Z0-9_\\.]+@[a-zA-Z0-9_\\.]+$/ if(!expr.test(obj.val())) { alert('Email error'); obj.focus(); return false; } obj=$('#txtphone'); if(obj.val()=='') { alert('Phone error'); obj.focus(); return false; } return true; } function box_enq_fn() { sendMail($('#enq_name').val(), $('#enq_mail').val(), $('#enq_msg').val()); }