var control_timeout, footerheight; $(document).ready(function(){ $("html").nicescroll({ autohidemode: false }); $('#menu').localscroll({hash:true, onafterfirst:function(){$('html, body').scrollto( {top:'-=25px'}, 'fast' );}}); $('#about-menu').localscroll({hash:true, onafterfirst:function(){$('html, body').scrollto( {top:'-=25px'}, 'fast' );}}); $('.logo').localscroll({hash:true}); $('.read-on').localscroll({hash:true}); is_ipad = navigator.useragent.tolowercase().indexof('ipad') > -1; if(is_ipad){ $('.menu-dropdown').removeclass('hidden'); $('#menu').addclass('hidden'); } else{ $('.menu-dropdown').addclass('hidden'); $('#menu').removeclass('hidden'); } $('#submit').click(function(event){ event.preventdefault(); if (valemail($('#email').attr('value')) && $('#name').attr('value')!=''){ $('html, body').scrollto( $('#contact'), 'fast' ); $.ajax({ type: 'post', url: 'send_form_email.php', data: $('#contact_form').serialize(), success: function(html) { if($(window).width()>=768){ divheight = getdivheight('form') - 80; $('#thanks').css('height',divheight) $('#form').removeclass('shadow'); $('#thanks').removeclass('hidden'); $('.bottom-shadow').addclass('hidden'); $('.no-shadow').removeclass('hidden'); $('#client_name').html($('#name').attr('value')); var msg = ''; if(html.success=='1') { msg = '

your message has been sent successfully

'; $("#form").flip({ direction: 'lr', color: '#fdfcf6', bgcolor: '#fdfcf6', speed: 200, content: msg }); } else show_error_msg(); } else { if(html.success=='1') { var msg = '

your message has been sent successfully

'; $('#client_name').html($('#name').attr('value')); $("#form").html(msg); } else show_error_msg(); } }, error: function(){ show_error_msg(); } }); } else { show_error_msg(); } }); init_scroll(); control_timeout = settimeout("no_run()",1350); $('.menu-btn').click(function(){ $('html, body').animate({ scrolltop: $(document).height() }, 'fast'); }); paddfooter(); }); $(window).resize(function(){ init_scroll (); $('#footer').css('padding-bottom','0'); paddfooter(); }); function paddfooter(){ if ($(window).width()<=590) { topheight = getdivheight('top') ; footerheight = getdivheight('footer'); $('#footer').css('padding-bottom', ($(window).height() - footerheight) - topheight + 'px'); } else{ $('#footer').css('padding-bottom','0'); } } function init_scroll () { if($(window).width()>=768){ nscroll = 4; nvisible = 4; }else{ if(($(window).width()<768) && ($(window).width()>=480)){ nscroll = 2; nvisible = 2; }else{ nscroll = 1; nvisible = 1; } } $('#slide-wrapper ul').caroufredsel({ responsive: true, width: '100%', height: '71px', scroll: nscroll, items: { width: 192, visible: nvisible }, swipe: { onmouse: true, ontouch: true }, pagination : "#foo2_pag" }); } function no_run(){ cleartimeout(control_timeout); } function valemail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; return re.test(email); } function show_error_msg() { $('#ajax-message').css('display','block').html('your message can not be sent at the moment, please try again later!'); } function getdivheight(objname) { return boxheight = document.getelementbyid(objname).clientheight; }