$(window).load(function() { $("#status").fadeOut(); // will first fade out the loading animation $("#preloader").delay(100).fadeOut("slow"); // will fade out the white DIV that covers the website. }); function miniInit() { if($('body').hasClass('dual-sidebar')){ dual_sidebar(); } function dual_sidebar(){ var $div = document.getElementById('footer-fixed'); //$div.attr('id', 'footer-fixed'); //$div.attr('class', 'active footer'); var snapper = new Snap({ element: document.getElementById('content'), elementMirror: document.getElementById('header-fixed'), //elementMirror2: document.getElementById('footer-fixed'), disable: 'none', tapToClose: true, touchToDrag: false, maxPosition: 266, minPosition: 0 }); $('.menu-item').click(function(){snapper.close();}); $(document).on('click', '.close-sidebar', function(){snapper.close();}); $('.open-left-sidebar').click(function() { //$(this).toggleClass('remove-sidebar'); //loadCounts(); if( snapper.state().state=="left" ){ snapper.close(); } else { snapper.open('left'); } return false; }); $('.open-right-sidebar').click(function() { //$(this).toggleClass('remove-sidebar'); if( snapper.state().state=="right" ){ snapper.close(); } else { snapper.open('right'); } return false; }); snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');}); if ($('.switch-1').length > 0) { checkCookie('notarchive',function(response) { if (response == '1') { $('.switch-1').click(); } }) } }; //Switches $('.switch-1').click(function(){ $(this).toggleClass('switch-1-on'); if (!$(this).hasClass('switch-1-on')) { $('.tasklist-completed').hide(); setCookie('notarchive','1'); } else { $('.tasklist-completed').show(); setCookie('notarchive','0'); } $('.list-container').each(function(i, obj) { if ($("a:visible").length < 1) { if (obj.closest('.noContent').length == 0) { $(this).append(''); $('.noContent').show(); } } else { $('.noContent').hide(); } }); return false; }); $('.switch-2').click(function(){ $(this).toggleClass('switch-2-on'); return false; }); $('.switch-3').click(function(){ $(this).toggleClass('switch-3-on'); return false; }); $('.switch, .switch-icon').click(function(){ $(this).parent().find('.switch-box-content').slideToggle(200); $(this).parent().find('.switch-box-subtitle').slideToggle(200); return false; }); } function init() { $('.show-submenu').click(function(){ $(this).parent().find('.submenu').toggleClass('submenu-active'); $(this).toggleClass('submenu-active'); }); /*Image Sliders*/ //Note. Every image slider must be placed within the timeout function.// //Image sliders put a lot of load on mobile devices and slow the performance of other animations// //But adding a timeout event, even for a microsecond gives a great boost in performance (41% boost to be exact) setTimeout(function() { //Simple Slider var owl = $('.simple-slider'); owl.owlCarousel({ animateOut: 'fadeOut', animateIn: 'fadeIn', items:1, loop:true, margin:5, autoplay:true, autoplayTimeout:3000, autoplayHoverPause:true }); //Coverpage Slider $('.coverpage-slider').owlCarousel({ loop:true, margin:-2, nav:false, dots:true, items:1 }); //Demo Slider inside Quotes $('.demo-slider').owlCarousel({ loop:true, margin:200, nav:false, autoHeight:true, responsive:{ 0:{ items:1 }, 600:{ items:2 } } }); $('.next-demo').click(function() {$('.demo-slider').trigger('next.owl.carousel');}); $('.prev-demo').click(function() {$('.demo-slider').trigger('prev.owl.carousel');}); //Homepage Slider No Transitions $('.homepage-slider-no-transition').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, loop:true, margin:10, nav:false, dots:false, items:1 }); //Homepage Slider With Transition $('.homepage-slider-transition').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, animateOut: 'fadeOut', animateIn: 'fadein', loop:true, margin:10, nav:false, dots:false, items:1 }); //Homepage Slider With Transition 2 $('.homepage-slider-transition-2').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, animateOut: 'slideOutDown', animateIn: 'slideInUp', loop:true, margin:10, nav:false, dots:false, items:1 }); //Homepage Slider With Transition 2 $('.homepage-slider-transition-3').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, animateOut: 'rollOut', animateIn: 'rollIn', loop:true, margin:10, nav:false, dots:false, items:1 }); $('.next-home-slider').click(function() {$('.homepage-slider-transition, .homepage-slider-transition-2, .homepage-slider-transition-3, .homepage-slider-no-transition').trigger('next.owl.carousel');}); $('.prev-home-slider').click(function() {$('.homepage-slider-transition, .homepage-slider-transition-2, .homepage-slider-transition-3, .homepage-slider-no-transition').trigger('prev.owl.carousel');}); //Staff Slider No Transition $('.staff-slider-no-transition').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, lazyLoad:true, loop:true, margin:10, nav:false, dots:false, responsive:{ 0:{ items:1 }, 600:{ items:2 }, 1000:{ items:3 } } }); //Staff Slider With Transition $('.staff-slider-transition').owlCarousel({ autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, animateOut: 'fadeOut', animateIn: 'fadeIn', lazyLoad:true, loop:true, margin:10, nav:false, dots:false, responsive:{ 0:{ items:1 }, 600:{ items:2 }, 1000:{ items:3 } } }); $('.next-staff-slider').click(function() {$('.staff-slider-no-transition, .staff-slider-transition').trigger('next.owl.carousel');}); $('.prev-staff-slider').click(function() {$('.staff-slider-no-transition, .staff-slider-transition').trigger('prev.owl.carousel');}); //Quote Slider No Transition $('.quote-slider-no-transition').owlCarousel({ autoHeight:true, autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, lazyLoad:true, loop:true, margin:10, nav:false, dots:false, responsive:{ 0:{ items:1 }, 600:{ items:1 }, 1000:{ items:1 } } }); //Quote Slider No Transition $('.quote-slider-transition').owlCarousel({ autoHeight:true, autoplay:true, autoplayTimeout:5000, autoplayHoverPause:true, animateOut: 'fadeOut', animateIn: 'fadeIn', lazyLoad:true, loop:true, margin:10, nav:false, dots:false, responsive:{ 0:{ items:1 }, 600:{ items:1 }, 1000:{ items:1 } } }); $('.next-quote-slider').click(function() {$('.quote-slider-no-transition, .quote-slider-transition').trigger('next.owl.carousel');}); $('.prev-quote-slider').click(function() {$('.quote-slider-no-transition, .quote-slider-transition').trigger('prev.owl.carousel');}); //Placing the Dots if Needed function slider_dots(){ var dots_width = (-($('.owl-dots').width()/2)); $('.owl-dots').css('position', 'absolute'); $('.owl-dots').css('left', '50%'); $('.owl-dots').css('margin-left', dots_width); } slider_dots(); }, 1); //Detect if iOS WebApp Engaged and permit navigation without deploying Safari (function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone") //Fast Click - Removing 300ms delay when clicking for instant response time $(function() { FastClick.attach(document.body); }); //Lazy Load | Preloading Image $(function() { $(".preload-image").lazyload({ threshold : 200, effect : "fadeIn" }); $("img.lazy").show().lazyload(); }); //Page Chapters Activation $('.show-page-chapters, .hide-chapters').click(function(){ $('.page-chapters').toggleClass('page-chapters-active'); }); $('.page-chapters a').click(function(){ $('.page-chapters a').removeClass('active-chapter'); $(this).addClass('active-chapter'); }); //Countdown timer var endDate = "June 7, 2015 15:03:25"; $(function() { $('.countdown-class').countdown({ date: "June 7, 2087 15:03:26" }); }); //Pie Charts if ($('body').hasClass('has-charts')){ var pieData = [ { value: 25, color: "#c0392b", highlight: "#c0392b", label: "Red" }, { value: 20, color: "#27ae60", highlight: "#27ae60", label: "Green" }, { value: 15, color: "#f39c12", highlight: "#f39c12", label: "Yellow" }, { value: 30, color: "#2980b9", highlight: "#34495e", label: "Dark Blue" } ]; var barChartData = { labels : ["One","Two","Three","Four","Five", "Six"], datasets : [{ fillColor : "rgba(0,0,0,0.1)", strokeColor : "rgba(0,0,0,0.2)", highlightFill: "rgba(0,0,0,0.25)", highlightStroke: "rgba(0,0,0,0.25)", data : [20,10,40,30,10, 80] }] } window.onload = function(){ var pie_chart_1 = document.getElementById("generate-pie-chart").getContext("2d"); window.pie_chart_1 = new Chart(pie_chart_1).Pie(pieData); var bar_chart_1 = document.getElementById("generate-bar-chart").getContext("2d"); window.bar_chart_1 = new Chart(bar_chart_1).Bar(barChartData); }; } //Tabs $('ul.tabs li').click(function(){ var tab_id = $(this).attr('data-tab'); $('ul.tabs li').removeClass('active-tab'); $('.tab-content').slideUp(200); $(this).addClass('active-tab'); $("#"+tab_id).slideToggle(200); }) //Accordion $('.accordion').find('.accordion-toggle').click(function(){ //Expand or collapse this panel $(this).next().slideDown(250); $('.accordion').find('i').removeClass('rotate-180'); $(this).find('i').addClass('rotate-180'); //Hide the other panels $(".accordion-content").not($(this).next()).slideUp(200); }); //Classic Toggles $('.toggle-title').click(function(){ $(this).parent().find('.toggle-content').slideToggle(200); $(this).find('i').toggleClass('rotate-toggle'); return false; }); //Notifications $('.static-notification-close').click(function(){ $(this).parent().slideUp(200); return false; }); $('.tap-dismiss').click(function(){ $(this).slideUp(200); return false; }); //Modal Launchers $('.modal-close').click(function(){return false;}); $('.simple-modal').click(function() { $('.simple-modal-content').modal(); }); $(document).on('click', '.simpleclickcat', function() { $('.simple-modal-content-cats').modal(); }); $(document).on('click','.simple-modal-terms',function() { loadTerms(); $('.simple-modal-content-terms').modal(); }); $('.simple-modal-policy').click(function() { loadDisclaimer(); $('.simple-modal-content-policy').modal(); }); $('.simple-modal-contact').click(function() { loadContacts(); $('.simple-modal-content-contact').modal(); }); $(document).on('click','.simple-modal-pleasecall',function() { $('.simple-modal-content-pleasecall').modal(); }); //Sharebox Settings $('.show-share-bottom, .show-share-box').click(function(){ $('.share-bottom').toggleClass('active-share-bottom'); $.modal.close() return false; }); $('.close-share-bottom').click(function(){ $('.share-bottom').removeClass('active-share-bottom'); return false; }); //Fixed Notifications //top $('.close-top-notification').click(function(){ $('.top-notification').slideUp(200); return false; }); $('.show-top-notification-1').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.top-notification-1').slideDown(200); }); $('.show-top-notification-2').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.top-notification-2').slideDown(200); }); $('.show-top-notification-3').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.top-notification-3').slideDown(200); }); //bottom $('.close-bottom-notification').click(function(){ $('.bottom-notification').slideUp(200); clearTimeout(notification_timer); return false; }); $('.show-bottom-notification-1').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.bottom-notification-1').slideDown(200); return false; }); $('.show-bottom-notification-2').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.bottom-notification-2').slideDown(200); return false; }); $('.show-bottom-notification-3').click(function(){ $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200); $('.bottom-notification-3').slideDown(200); return false; }); //Timeout $('.timer-notification').click(function(){ var notification_timer; notification_timer = setTimeout(function(){ $('.timeout-notification').slideUp(250); },5000); }); //Reminders & Checklists & Tasklists $('.reminder-check-square').click(function(){ $(this).toggleClass('reminder-check-square-selected'); return false; }); $('.reminder-check-round').click(function(){ $(this).toggleClass('reminder-check-round-selected'); return false; }); $('.checklist-square').click(function(){ $(this).toggleClass('checklist-square-selected'); return false; }); $('.checklist-round').click(function(){ $(this).toggleClass('checklist-round-selected'); return false; }); $('.tasklist-incomplete').click(function(){ $(this).removeClass('tasklist-incomplete'); $(this).addClass('tasklist-completed'); }); $('.tasklist-item').click(function(){ $(this).toggleClass('tasklist-completed'); }); //Activity Item Toggle $('.activity-item').click(function(){ $(this).find('.activity-item-detail').slideToggle(200); }); //Detecting Mobiles// var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; if(isMobile.any()) { //Settings for all mobiles $('head').append(''); } if( !isMobile.any() ){ $('.show-blackberry, .show-ios, .show-windows, .show-android').hide(0); $('show-no-detection').show(0); $('#content').bind('mousewheel', function(event) { event.preventDefault(); var scrollTop = this.scrollTop; this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -2)); //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta); }); $("#content").css("overflow-y","hidden"); } if(isMobile.Android()) { $('.show-android').show(0); $('.show-blackberry, .show-ios, .show-windows').hide(0); } if(isMobile.BlackBerry()) { $('.show-blackberry').show(0); $('.show-android, .show-ios, .show-windows').hide(0); } if(isMobile.iOS()) { $('.show-ios').show(0); $('.show-blackberry, .show-android, .show-windows').hide(0); } if(isMobile.Windows()) { $('.show-windows').show(0); $('.show-blackberry, .show-ios, .show-android').hide(0); } $('.back-to-top-badge, .back-to-top').click(function() { $('#content').animate({ scrollTop:0 }, 500, 'easeInOutQuad'); return false; }); //Show Back To Home When Scrolling $('#content').on('scroll', function () { var total_scroll_height = $('#content')[0].scrollHeight var inside_header = ($(this).scrollTop() <= 150); var passed_header = ($(this).scrollTop() >= 0); //250 var footer_reached = ($(this).scrollTop() >= (total_scroll_height - ($(window).height() +100 ))); if (inside_header == true) { $('.back-to-top-badge').removeClass('back-to-top-badge-visible'); } else if (passed_header == true) { $('.back-to-top-badge').addClass('back-to-top-badge-visible'); } if (footer_reached == true){ $('.back-to-top-badge').removeClass('back-to-top-badge-visible'); //$('#footer-fixed').removeClass('not-active'); //$('#footer-fixed').addClass('active'); } }); //Make contianer fullscreen// function create_paddings(){ var no_padding = $(window).width(); function mobile_paddings(){ $('.content').css('padding-left', '20px'); $('.content').css('padding-right', '20px'); $('.container-fullscreen, .image-fullscreen').css('margin-left', '-21px'); $('.container-fullscreen, .image-fullscreen').css('width', no_padding +2); } function tablet_paddings(){ $('.content').css('padding-left', '50px'); $('.content').css('padding-right', '50px'); $('.container-fullscreen, .image-fullscreen').css('margin-left', '-51px'); $('.container-fullscreen, .image-fullscreen').css('width', no_padding +2); } if($(window).width() < 766){ mobile_paddings() } if($(window).width() > 766){ tablet_paddings() } } $(window).resize(function() { create_paddings(); }); create_paddings(); //Morph Headings $(".infinite-text").Morphext({ // The [in] animation type. Refer to Animate.css for a list of available animations. animation: "flipInX", // An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple | Very Doge | Much Wow | Such Cool). separator: "|", // The delay between the changing of each phrase in milliseconds. speed: 2000, complete: function () { // Called after the entrance animation is executed. } }); //Set inputs to today's date by adding class set-day var set_input_now = new Date(); var set_input_month = (set_input_now.getMonth() + 1); var set_input_day = set_input_now.getDate(); if(set_input_month < 10) set_input_month = "0" + set_input_month; if(set_input_day < 10) set_input_day = "0" + set_input_day; var set_input_today = set_input_now.getFullYear() + '-' + set_input_month + '-' + set_input_day; $('.set-today').val(set_input_today); //Portfolios and Gallerties $('.adaptive-one').click(function(){ $('.portfolio-switch').removeClass('active-adaptive'); $(this).addClass('active-adaptive'); $('.portfolio-adaptive').removeClass('portfolio-adaptive-two portfolio-adaptive-three'); $('.portfolio-adaptive').addClass('portfolio-adaptive-one'); return false; }); $('.adaptive-two').click(function(){ $('.portfolio-switch').removeClass('active-adaptive'); $(this).addClass('active-adaptive'); $('.portfolio-adaptive').removeClass('portfolio-adaptive-one portfolio-adaptive-three'); $('.portfolio-adaptive').addClass('portfolio-adaptive-two'); return false; }); $('.adaptive-three').click(function(){ $('.portfolio-switch').removeClass('active-adaptive'); $(this).addClass('active-adaptive'); $('.portfolio-adaptive').removeClass('portfolio-adaptive-two portfolio-adaptive-one'); $('.portfolio-adaptive').addClass('portfolio-adaptive-three'); return false; }); //Wide Portfolio $('.show-wide-text').click(function(){ $(this).parent().find('.wide-text').slideToggle(200); return false; }); $('.portfolio-close').click(function(){ $(this).parent().parent().find('.wide-text').slideToggle(200); return false; }); $('.show-gallery, .show-gallery-1, .show-gallery-2, .show-gallery-3, .show-gallery-4, .show-gallery-5, .add-gallery a').swipebox(); function apply_gallery_justification(){ var screen_widths = $(window).width(); if( screen_widths < 768){ $('.gallery-justified').justifiedGallery({ rowHeight : 70, maxRowHeight : 370, margins : 5, fixedHeight:false }); }; if( screen_widths > 768){ $('.gallery-justified').justifiedGallery({ rowHeight : 150, maxRowHeight : 370, margins : 5, fixedHeight:false }); }; }; apply_gallery_justification(); //Filterable Gallery var selectedClass = ""; $(".filter-category").click(function(){ $('.portfolio-filter-categories a').removeClass('selected-filter'); $(this).addClass('selected-filter'); selectedClass = $(this).attr("data-rel"); $(".portfolio-filter-wrapper").show(250); $(".portfolio-filter-wrapper div").not("."+selectedClass).delay(100).hide(250); setTimeout(function() { $("."+selectedClass).show(250); $(".portfolio-filter-wrapper").show(250); }, 0); }); //Fullscreen Map $('.map-text, .map-overlay').click(function(){ $('.map-text, .map-overlay').fadeOut(200); $('.deactivate-map').fadeIn(200); }); $('.deactivate-map').click(function(){ $('.map-text, .map-overlay').fadeIn(200); $('.deactivate-map').fadeOut(200); }); function generate_map(){ var map_width = $(window).width(); var map_height = $(window).height(); $('.map-fullscreen iframe').css('width', map_width); $('.map-fullscreen iframe').css('height', map_height); }; generate_map(); //-------------------Generate Cover Screen Elements--------------------// //Global Settings for Fullscreen Pages, PageApps and Coverscreen Slider// function align_cover_elements(){ var cover_width = $(window).width(); var cover_height = $(window).height(); var cover_vertical = -($('.cover-center').height())/2; var cover_horizontal = -($('.cover-center').width())/2; $('.cover-screen').css('width', cover_width); //$('.cover-screen').css('min-height', cover_height); $('.cover-screen .overlay').css('width', cover_width); $('.cover-screen .overlay').css('height', cover_height); //$('.cover-center').css('margin-left', cover_horizontal); //$('.cover-center').css('margin-top', cover_vertical + 90); $('.cover-left').css('margin-top', cover_vertical); $('.cover-right').css('margin-top', cover_vertical); }; align_cover_elements(); //Resize Functions// $(window).resize(function(){ apply_gallery_justification(); align_cover_elements(); generate_map(); }); //Add To HomeScreen /* addToHomescreen({ skipFirstVisit: false, detectHomescreen:true, maxDisplayCount: 140, startDelay:1, autostart:true, lifespan:0 }); */ //Swipebox Image Gallery// //SVG Usage is not recommended due to poor compatibility with older Android / Windows Mobile Devices// $(".swipebox").swipebox({ useCSS : true, hideBarsDelay : 0 // 0 to always show caption and action bar }); //Sidebar Activation for pages with proper functions if($('body').hasClass('left-sidebar')){ left_sidebar(); } if($('body').hasClass('right-sidebar')){ right_sidebar(); } if($('body').hasClass('no-sidebar')){ no_sidebar(); } miniInit(); function left_sidebar(){ var $div = $('
').appendTo('body'); $div.attr('id', 'footer-fixed'); $div.attr('class', 'not-active'); var snapper = new Snap({ element: document.getElementById('content'), elementMirror: document.getElementById('header-fixed'), //elementMirror2: document.getElementById('footer-fixed'), disable: 'right', tapToClose: true, touchToDrag: true, maxPosition: 266, minPosition: -266 }); //$('.close-sidebar').click(function(){snapper.close();}); $(document).on('click', '.close-sidebar', function(){snapper.close();}); $('.open-left-sidebar').click(function() { //$(this).toggleClass('remove-sidebar'); if( snapper.state().state=="left" ){ snapper.close(); } else { snapper.open('left'); } return false; }); snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');}); }; function right_sidebar(){ var $div = $('
').appendTo('body'); $div.attr('id', 'footer-fixed'); $div.attr('class', 'not-active'); var snapper = new Snap({ element: document.getElementById('content'), elementMirror: document.getElementById('header-fixed'), //elementMirror2: document.getElementById('footer-fixed'), disable: 'left', tapToClose: true, touchToDrag: true, maxPosition: 266, minPosition: -266 }); $(document).on('click', '.close-sidebar', function(){snapper.close();}); $('.open-right-sidebar').click(function() { //$(this).toggleClass('remove-sidebar'); if( snapper.state().state=="right" ){ snapper.close(); } else { snapper.open('right'); } return false; }); snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');}); }; function no_sidebar(){ var snapper = new Snap({ element: document.getElementById('content'), elementMirror: document.getElementById('header-fixed'), //elementMirror2: document.getElementById('footer-fixed'), disable: 'none', tapToClose: false, touchToDrag: false }); }; } function reloadStylesheets() { var queryString = '&reload=' + new Date().getTime(); $('link[rel="stylesheet"].mainSheet').each(function () { //this.href = this.href.replace(/\?.*|$/, queryString); $('.mainSheet').attr('href',this.href + queryString); }); } function redirect(action, params = "", loadElement, navitem) { if (!params || params == "undefined" || params == "") { params = ""; } else { params = params.indexOf('&') == 0 ? params.replace("&","?") : params; } loadElement = "#main-content"; if (navitem && navitem !== "undefined" && navitem !== "") { $( ".menu-item" ).removeClass("menu-item-active"); $( ".menu-item[name=" + navitem + "]" ).addClass("menu-item-active"); } findurl = "includes/template_custom/app/" + action + ".html" + params $.ajax({ type: "GET", url: findurl, datatype: "html", success: function(response, textStatus, xhr) { if (xhr.status == '403') { redirect("login"); } else { $(loadElement).html(response); miniInit(); if (action == 'home') { $('.open-left-sidebar').hide(); } else { $('.open-left-sidebar').show(); } } }, error: function(e) { console.log('Error: ' + e.message); } }); } function loadLeave(leave_id) { /*if (jQuery(".list-container" + leave_id).html() == "") { jQuery(".list-container" + leave_id).html(""); var postUrl = "https://rmibs.co.za/api/app/leave/"; var postData = {}; postData['formAction'] = 'getLeave'; postData['dataid'] = leave_id; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".list-container" + leave_id).html(response); } else { jQuery(".list-container" + leave_id).html("
No leave records available
"); } } }); }*/ $(".list-container:not(.list-container" + leave_id + ")").parent('.toggle-content').slideUp(200); $(".list-container" + leave_id).parent('.toggle-content').slideToggle(200); $(".list-container:not(.list-container" + leave_id + ")").parent().parent('.toggle').find('.toggle-title').find('i').removeClass('rotate-toggle'); $(".list-container" + leave_id).parent().parent('.toggle').find('.toggle-title').find('i').toggleClass('rotate-toggle'); } function loadCounts() { loadNotifCounts(); loadDocCounts() } function loadNotifCounts() { var data = { formAction: "getNotificationCount" }; var postUrl = "https://rmibs.co.za/api/app/notifications/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { $(".notifCount").html(data); if (data == '0') { $(".notifCount").hide(); } else { $(".notifCount").show(); } }); } function loadDocCounts() { var data = { formAction: "getDocumentCount" }; var postUrl = "https://rmibs.co.za/api/app/documents/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { $(".docCount").html(data); if (data == '0') { $(".docCount").hide(); } else { $(".docCount").show(); } }); } function loadEvents(eventtype) { var postUrl = "https://rmibs.co.za/app/includes/template_custom/app/events.html?etype="+eventtype; $.ajax({ url: postUrl, type: "GET", dataType: 'html', success: function(response) { console.log(response); } }); } function loadEventItem(item_id) { var postData = {}; postData['formAction'] = 'getEventItem'; postData['item_id'] = item_id; var postUrl = "https://rmibs.co.za/api/app/events/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $('.eventContainerType').hide(); $("#eventItemContainer").html(response); $("#eventItemContainer").show(); $(".consIntroImageFull").addClass('consIntroImage'); } }); } function loadNotifications(notify_category_id) { $(".list-container:not(.list-container" + notify_category_id + ")").parent('.toggle-content').slideUp(200); $(".list-container" + notify_category_id).parent('.toggle-content').slideToggle(200); $(".list-container:not(.list-container" + notify_category_id + ")").parent().parent('.toggle').find('.toggle-title').find('i').removeClass('rotate-toggle'); $(".list-container" + notify_category_id).parent().parent('.toggle').find('.toggle-title').find('i').toggleClass('rotate-toggle'); } function loadDocuments(category_id) { /*if (jQuery(".list-container" + category_id).html() == "") { jQuery(".list-container" + category_id).html(""); var postUrl = "https://rmibs.co.za/api/app/documents/"; var postData = {}; postData['formAction'] = 'getDocuments'; postData['dataid'] = category_id; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".list-container" + category_id).html(response); } else { jQuery(".list-container" + category_id).html("
No documents available
"); } } }); }*/ $(".list-container:not(.list-container" + category_id + ")").parent('.toggle-content').slideUp(200); $(".list-container" + category_id).parent('.toggle-content').slideToggle(200); $(".list-container:not(.list-container" + category_id + ")").parent().parent('.toggle').find('.toggle-title').find('i').removeClass('rotate-toggle'); $(".list-container" + category_id).parent().parent('.toggle').find('.toggle-title').find('i').toggleClass('rotate-toggle'); } function downloadFile(dataid) { var postData = {}; postData['formAction'] = 'getDocument'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The document could not be displayed"); //jQuery(".disclaimerContent").html("
The document could not be displayed
"); } } }); } function downloadGuide(dataid) { var postData = {}; postData['formAction'] = 'getGuide'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The guideline could not be displayed"); //jQuery(".disclaimerContent").html("
The document could not be displayed
"); } } }); } function downloadMagazine(dataid) { var postData = {}; postData['formAction'] = 'getMagazine'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/magazines/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The magazine could not be displayed"); } } }); } function downloadCompliance(dataid) { var postData = {}; postData['formAction'] = 'getDocument'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The document could not be displayed"); } } }); } function downloadVas(dataid) { var postData = {}; postData['formAction'] = 'getVas'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/vas/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The VAS could not be displayed"); } } }); } function downloadNewsletter(dataid) { var postData = {}; postData['formAction'] = 'getNewsletter'; postData['data-id'] = dataid; var postUrl = "https://rmibs.co.za/api/app/newsletters/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if ((response.length > 0) && (response != "NotExist")) { if (window.isAndroid) { window.open(encodeURI(response),"_system"); } else { window.open(encodeURI(response),"_system"); //cordova.InAppBrowser.open(encodeURI(response), '_system', 'location=yes'); } } else { alert("The newsletter could not be displayed"); } } }); } function loadDocCatSelect() { var postData = {}; postData['formAction'] = 'getDocCatSelect'; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".catdropdown").html(response); } else { jQuery(".catdropdown").html(""); } } }); } function getServiceTypeDropdown() { var postData = {}; postData['formAction'] = 'getServiceTypeDropdown'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".catfind").html(response); } else { jQuery(".catfind").html(""); } } }); } function getAreaDropdown() { var postData = {}; postData['formAction'] = 'getAreaDropdown'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".areafind").html(response); } else { jQuery(".areafind").html(""); } } }); } function getBrandDropdown() { var postData = {}; postData['formAction'] = 'getBrandDropdown'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".brandfind").html(response); } else { jQuery(".brandfind").html(""); } } }); } function getServiceTypeDropdownSpecials() { var postData = {}; postData['formAction'] = 'getServiceTypeDropdownSpecials'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".catfind").html(response); } else { jQuery(".catfind").html(""); } } }); } function getAreaDropdownSpecials() { var postData = {}; postData['formAction'] = 'getAreaDropdownSpecials'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".areafind").html(response); } else { jQuery(".areafind").html(""); } } }); } function getBrandDropdownSpecials() { var postData = {}; postData['formAction'] = 'getBrandDropdownSpecials'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".brandfind").html(response); } else { jQuery(".brandfind").html(""); } } }); } function loadDisclaimer() { var postData = {}; postData['formAction'] = 'getDisclaimer'; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".disclaimerContent").html(response); } else { jQuery(".disclaimerContent").html("
No disclaimer available
"); } } }); } function loadTerms() { var postData = {}; postData['formAction'] = 'getTerms'; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".termsContent").html(response); } else { jQuery(".termsContent").html("
No terms available
"); } } }); } function loadContacts() { var postData = {}; postData['formAction'] = 'getContacts'; var postUrl = "https://rmibs.co.za/api/app/contact/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".contactContent").html(response); } else { jQuery(".contactContent").html("
No contacts available
"); } } }); } function retrieveDisclaimer(doc_id) { var postData = {}; postData['formAction'] = 'retrieveDisclaimer'; postData['doc_id'] = doc_id; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".disclaimerContent").html(response); } else { jQuery(".disclaimerContent").html("
No disclaimer available
"); } } }); } function loadDocumentCategories() { var componentArray = { formAction: "getDocumentCategories" }; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { $("#documentContainer").html(response); } }); } function loadNotificationCategories() { var componentArray = { formAction: "getNotificationCategories" }; var postUrl = "https://rmibs.co.za/api/app/notifications/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { $("#notificationContainer").html(response); // showObjectjQuery(response); //bootbox.alert("Updated complete"); /*if (response) { } else { bootbox.alert("Error while removing the entry"); }*/ } }); } function loadNotification(notifid) { var postData = {}; postData['formAction'] = 'getNotification'; postData['data-id'] = notifid; var postUrl = "https://rmibs.co.za/api/app/notifications/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery(".notificationContent").html(response); } else { jQuery(".notificationContent").html("
No notification available
"); } } }); } function loadLeaveCategories() { var componentArray = { formAction: "getLeaveCategories" }; var postUrl = "https://rmibs.co.za/api/app/leave/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { $("#leaveContainer").html(response); } }); } function loadHome() { var flogcheck; var componentArray = { formAction: "getHome" }; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { $(".home-blocks").html(response); $(".consIntroImage h3").html("Welome to RMI Connect"); $('.open-left-sidebar').hide(); checkCookie('firstlogset',function(response){ if (response == '1') { if ($('.simple-modal-content-cats').length == 0) { $('.simple-modal-pleasecall').after(''); } $('.simple-modal-content-cats').modal(); } }); } }); } function accessCookie(cookieName) { var name = cookieName + "="; var allCookieArray = document.cookie.split(';'); for(var i=0; i < allCookieArray.length; i++) { var temp = allCookieArray[i].trim(); if (temp.indexOf(name)==0) return temp.substring(name.length,temp.length); } return ""; } function checkCookie(checker,callback) { var componentArray = { formAction: "checkCookie", data: checker }; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { if (callback) { callback(response); } } }); } function getCookie(checker,callback) { var componentArray = { formAction: "getCookie", data: checker }; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { if (callback) { callback(response); } } }); } function setCookie(checker,checkvalue) { var componentArray = { formAction: "setCookie", data: checker, dataval: checkvalue }; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { return response; } }); } function removeCookie(checker) { var componentArray = { formAction: "removeCookie", data: checker }; var postUrl = "https://rmibs.co.za/api/app/login/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { return response; } }); } function loadMagazines() { var componentArray = { formAction: "getMagazines" }; var postUrl = "https://rmibs.co.za/api/app/magazines/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { $("#magazineContainer").html(response); } }); } function loadVass(cat_id) { var postData = {}; postData['formAction'] = 'getVass'; postData['cat_id'] = cat_id; var postUrl = "https://rmibs.co.za/api/app/vas/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#vasContainer").html(response); } }); } function loadDocs(cat_id = '') { var postData = {}; postData['formAction'] = 'getDocsApp'; postData['cat_id'] = cat_id; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#docContainer").html(response); } }); } function loadCompliance(assoc) { var postData = {}; postData['formAction'] = 'getDocsAppAss'; postData['assoc'] = assoc; var postUrl = "https://rmibs.co.za/api/app/documents/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#assocContainer").html(response); } }); } function loadAssocCompliance(assoc) { $('.assoctitle').hide(); $('#listView').show(); loadCompliance(assoc); } function loadAssocItem(member_id) { var postData = {}; postData['formAction'] = 'getAssocItem'; postData['member_id'] = member_id; var postUrl = "https://rmibs.co.za/api/app/news/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsContainer").html(response); var newimage = $(".articleImage").attr('src'); $(".consIntroImage").css("background-image","url('" + newimage + "')"); } }); } function loadGuidelinesList() { var postData = {}; postData['formAction'] = 'getGuidelinesList'; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#guidelinesContainer").html(response); } }); } function loadGuide(item_id) { var postData = {}; postData['formAction'] = 'getGuideItem'; postData['item_id'] = item_id; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#guidelinesContainer").html(response); } }); } function getCourseList() { var postData = {}; postData['formAction'] = 'getCourseList'; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#trainingContainer").html(response); } }); } function loadCourse(item_id) { var postData = {}; postData['formAction'] = 'getCourseItem'; postData['item_id'] = item_id; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#trainingContainer").html(response); } }); } function loadNewsletter(mem_type) { var postData = {}; postData['formAction'] = 'getNewsletters'; postData['mem_type'] = mem_type; var postUrl = "https://rmibs.co.za/api/app/newsletters/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsletterContainer").html(response); } }); } function loadService(searchdata) { var postData = {}; postData['formAction'] = 'getMemberList'; postData['searchdata'] = searchdata; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response !== "") { $("#serviceContainer").html(response); } } }); } function loadSpecials(searchdata) { var postData = {}; postData['formAction'] = 'getSpecialList'; postData['searchdata'] = searchdata; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { if (response.length > 0) { jQuery("#specialsContainer").html(response); } else { jQuery("#specialsContainer").html("
No specials available
"); } } }); } function loadStation(cat_id) { var postData = {}; postData['formAction'] = 'getItemList'; postData['cat_id'] = cat_id; var postUrl = "https://rmibs.co.za/api/app/inventory/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#statContainer").html(response); } }); } function loadOrder() { var postData = {}; postData['formAction'] = 'getQuoteButton'; var postUrl = "https://rmibs.co.za/api/app/orders/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#orderContainer").html(response); } }); } function loadMapData(url,callback) { var postData = {}; postData['formAction'] = 'getMapData'; postData['location'] = GetURLParameterList(url,'location'); postData['radius'] = GetURLParameterList(url,'radius'); postData['catfind'] = GetURLParameterList(url,'catfind'); postData['areafind'] = GetURLParameterList(url,'areafind'); postData['brandfind'] = GetURLParameterList(url,'brandfind'); var result; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', async: false, data: postData, success: function(response) { result = response; callback(result); } }); } function loadSpecialMapData(url,callback) { console.log(url); var postData = {}; postData['formAction'] = 'getSpecialMapData'; postData['location'] = GetURLParameterList(url,'location'); postData['radius'] = GetURLParameterList(url,'radius'); postData['catfind'] = GetURLParameterList(url,'catfind'); postData['areafind'] = GetURLParameterList(url,'areafind'); postData['brandfind'] = GetURLParameterList(url,'brandfind'); var result; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', async: false, data: postData, success: function(response) { result = response; callback(result); } }); } function switchCats() { var componentArray = { formAction: "getProfileCats" }; var postUrl = "https://rmibs.co.za/api/app/profiles/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: componentArray, success: function(response) { checkCookie('firstlogset',function(response2){ if (response2 == '1') { removeCookie('firstlogset'); setCookie('firstlogsetdone','1'); } }); $('#profileForm fieldset').html(response); $('.consIntroImage h3').html('Business Categories'); //showObjectjQuery(response); } }); } function addSectorMem(sectorid) { var data = { formAction: 'addSectorMem', data: sectorid }; var postUrl = "https://rmibs.co.za/api/app/profiles/"; var postData = data; $.ajax({ url: postUrl, type: "POST", data: postData, success: function(response) { $('.selSectorContainer').html(response); } }); } function loadAssocs(searchdata) { var postData = {}; postData['formAction'] = 'getAssocList'; postData['searchdata'] = '2'; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $('.complist').hide(); $('#listView').hide(); $('.assocname').html(""); $('.assoctitle').html('Find our Associations'); $('.assoctitle').show(); $("#assocContainer").html(response); } }); } function loadGallery() { var postData = {}; postData['formAction'] = 'getGalleryList'; var postUrl = "https://rmibs.co.za/api/app/training/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#galleryContainer").html(response); } }); } function getAssocDetails(member_id,callback) { var postData = {}; postData['formAction'] = 'getMemberDetails'; postData['member_id'] = member_id; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { result = response; callback(result); //$(".simplemodal-data").html(response); } }); } function loadNews(cat_id) { var postData = {}; postData['formAction'] = 'getNews'; postData['cat_id'] = cat_id; var postUrl = "https://rmibs.co.za/api/app/news/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsContainer").html(response); var newimage = $(".consIntroImageDup").css("background-image"); newimage = newimage.replace('url("','') newimage = newimage.replace('")','') $(".consIntroImage").css("background-image","url('" + newimage + "')"); } }); } function loadNewsAll(cat_id) { var postData = {}; postData['formAction'] = 'getNewsAll'; postData['cat_id'] = cat_id; var postUrl = "https://rmibs.co.za/api/app/news/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsContainer").html(response); var newimage = $(".consIntroImageDup").css("background-image"); newimage = newimage.replace('url("','') newimage = newimage.replace('")','') $(".consIntroImage").css("background-image","url('" + newimage + "')"); } }); } function loadEnquiry(type_id) { var postData = {}; postData['formAction'] = 'getEnquiry'; postData['type_id'] = type_id; var postUrl = "https://rmibs.co.za/api/app/contact/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#enquiryForm fieldset").html(response); } }); } function loadNewsItem(news_id) { var postData = {}; postData['formAction'] = 'getNewsItem'; postData['news_id'] = news_id; var postUrl = "https://rmibs.co.za/api/app/news/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsContainer").html(response); var newimage = $(".articleImage").attr('src'); $(".consIntroImage").css("background-image","url('" + newimage + "')"); } }); } function loadNewsItemAll(news_id) { var postData = {}; postData['formAction'] = 'getNewsItemAll'; postData['news_id'] = news_id; var postUrl = "https://rmibs.co.za/api/app/news/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $("#newsContainer").html(response); var newimage = $(".articleImage").attr('src'); $(".consIntroImage").css("background-image","url('" + newimage + "')"); } }); } function addToBasket(item_id,requested) { var postData = {}; postData['formAction'] = 'addItems'; postData['item_id'] = item_id; postData['requested'] = requested; var postUrl = "https://rmibs.co.za/api/app/orders/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $(".modal-content h4").html(response).css('text-align','center'); $(".requestData").hide(); $(".modal-content p").hide(); //redirect('view-order'); } }); } function updateBasket(item_id,requested) { var postData = {}; postData['formAction'] = 'updateItems'; postData['item_id'] = item_id; postData['requested'] = requested; var postUrl = "https://rmibs.co.za/api/app/orders/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { $(".modal-content h4").html(response).css('text-align','center'); $(".requestData").hide(); $(".modal-content p").hide(); redirect('view-order'); } }); } function confirmOrder() { var postData = { formAction: 'sendOrderApprovalRequest' }; var postUrl = "https://rmibs.co.za/api/app/orders/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { data = JSON.parse(response); $(".modal-content h4").html(data[1]).css('text-align','center'); $(".requestData").hide(); $(".simple-modal-content").modal({ onClose: function (dialog) { redirect('stationary'); $.modal.close(); // must call this! } }); ; } }); } function getMemberDetails(member_id,callback) { var postData = {}; postData['formAction'] = 'getMemberDetails'; postData['member_id'] = member_id; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { result = response; callback(result); //$(".simplemodal-data").html(response); } }); } function getMemberDetailsFormat(member_id,callback) { var postData = {}; postData['formAction'] = 'getMemberDetailsFormat'; postData['member_id'] = member_id; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { result = response; //console.log(result); callback(result); //$(".simplemodal-data").html(response); } }); } function getAssocDetailsFormat(member_id,callback) { var postData = {}; postData['formAction'] = 'getAssocDetailsFormat'; postData['member_id'] = member_id; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { result = response; //console.log(result); callback(result); //$(".simplemodal-data").html(response); } }); } function getMemberSpecialsFormat(special_id,callback) { var postData = {}; postData['formAction'] = 'getSpecialDetailsFormat'; postData['special_id'] = special_id; var postUrl = "https://rmibs.co.za/api/app/members/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function(response) { result = response; //console.log(result); callback(result); } }); } function callMeBack(contactrequest) { var postData = {}; postData['formAction'] = 'sendCallMe'; postData['contactrequest'] = contactrequest; var postUrl = "https://rmibs.co.za/api/app/contact/"; $.ajax({ url: postUrl, type: "POST", dataType: 'html', data: postData, success: function (response) { if (response == '1') { $(".callmeContent").html('

Thank you. We will be in contact with you as soon as possible

').css('text-align','center'); } else { $(".callmeContent").html('

There was a problem processing your request. Please try again

').css('text-align','center'); } } }); } function switchTab(selectedtab) { $(".atab").hide(); $("#" + selectedtab).show(); //console.log(selectedtab); if (selectedtab == 'mapContainer') { $('#serviceForm').hide(); //$('.backtolist').show(); } else { $('#serviceForm').show(); // $('.backtolist').hide(); } } function GetURLParameterList(sParam,lParam){ var sPageURL = sParam; var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++){ var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == lParam) { return sParameterName[1]; } } } function GetURLParameter(sParam){ //console.log(sParam); //console.log(window.location); var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++){ var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } function submitForm(thisForm, selectedType, loadTo) { //capture form submits //prevent form from submitting //thisForm.preventDefault(); //available for mobile? /*if (jQuery('#message').length) { $('#message').val(CKEDITOR.instances.message.getData()); }*/ var data = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/" + selectedType + "/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { jQuery(".updateMessage").html(data); $('.simple-modal-content').modal(); }); } function submitLogin(thisForm) { //capture form submits //prevent form from submitting //thisForm.preventDefault(); //available for mobile? /*if (jQuery('#message').length) { $('#message').val(CKEDITOR.instances.message.getData()); }*/ var formData = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = formData; //postData = JSON.parse(data); //console.log(postData); jQuery.post(postUrl, postData, function (data, status) { //dataSet = JSON.parse(data); dataSet = data; if (dataSet[0] !== "1") { $('.open-left-sidebar').hide(); jQuery(".updateMessage").html(dataSet[1]); $(".simple-modal-content-login").modal({ onClose: function (dialog) { location.reload(true); $.modal.close(); // must call this! } }); } else { getMenu(); getMenuButton(); reloadStylesheets(); init(); redirect('home'); //$('.open-left-sidebar').show(); } }); } function submitRegister(thisForm) { var formData = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = formData; jQuery.post(postUrl, postData, function (data, status) { dataSet = JSON.parse(data); if (dataSet[0] !== "1") { jQuery(".updateMessage").html(dataSet[1]); $(".simple-modal-content-login").modal({ onClose: function (dialog) { $.modal.close(); // must call this! } }); } else { jQuery(".updateMessage").html(dataSet[1]); $(".simple-modal-content-login").modal({ onClose: function (dialog) { location.reload(true); $.modal.close(); // must call this! } }); } }); } function submitRequest(thisForm) { var formData = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = formData; jQuery.post(postUrl, postData, function (data, status) { dataSet = JSON.parse(data); if (dataSet[0] !== "1") { jQuery(".updateMessage").html(dataSet[1]); $(".simple-modal-content-login").modal({ onClose: function (dialog) { location.reload(true); $.modal.close(); // must call this! } }); } else { jQuery(".updateMessage").html(dataSet[1]); $('.simple-modal-content').modal(); } }); } function getForgot(thisForm) { var data = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { $(".forgotContainer").html(data); }); } function getVerify(thisForm) { var passflag = true; if ($('#confpass').length > 0) { if ($('#email').val() !== $('#confirm_email').val()) { $(".verifyContainer .errormessage").remove(); $(".verifyContainer #verifyForm").after("
Email addresses do not match
"); passflag = false; } if ($('#pass').val() !== $('#confpass').val()) { $(".verifyContainer .errormessage").remove(); $(".verifyContainer #verifyForm").after("
Passwords do not match
"); passflag = false; } } if (passflag) { var dataset = jQuery(thisForm).serializeArray(); var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = dataset; jQuery.post(postUrl, postData, function (data, status) { var obj = JSON.parse(data); if (obj.type == '1') { //$(".verifyContainer .errormessage").remove(); //$(".verifyContainer").prepend("
" + obj.message + "
"); redirect('login'); setTimeout(function(){ loadlogin('2'); }, 100); } else if (obj.type == '2') { $(".verifyContainer").html(obj.message); } else { $(".verifyContainer .errormessage").remove(); $(".verifyContainer #verifyForm").after("
" + obj.message + "
"); } }); } } function loadlogin(selecttype) { if (selecttype == '1') { $('.landingLoginMember').hide(); $('.landingLoginConsumer').addClass('consumer'); $('.landingLoginConsumer').removeClass('member'); $('.landingLoginConsumer').show(); $('.landingRegisterConsumer').hide(); $('.landingRegisterMember').hide(); //$('.loginlabel').html("Email"); } else { $('.landingLoginConsumer').hide(); $('.landingLoginMember').addClass('member'); $('.landingLoginMember').removeClass('consumer'); $('.landingLoginMember').show(); $('.landingRegisterConsumer').hide(); $('.landingRegisterMember').hide(); //$('.loginlabel').html("Member number"); } //$('.landingLogin').show(); $('.landingOverlay').hide(); $('.landingRegisterConsumer').hide(); $('.landingRegisterMember').hide(); } function loadregister(selecttype) { if (selecttype == '1') { $('.landingRegisterConsumer').show(); $('.landingRegisterMember').hide(); $('.landingLoginConsumer').hide(); $('.landingLoginMember').hide(); } else { $('.landingRegisterConsumer').hide(); $('.landingRegisterMember').show(); $('.landingLoginConsumer').hide(); $('.landingLoginMember').hide(); } $('.landingLogin').hide(); $('.landingOverlay').hide(); } function getMenu() { var data = { formAction: "getMenu" }; var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { $(".snap-drawer").prepend(data); }); } function getMenuButton() { var data = { formAction: "getMenuButton" }; var postData = data; var postUrl = "https://rmibs.co.za/api/app/login/"; jQuery.post(postUrl, postData, function (data, status) { $("#header-fixed").prepend(data); //$('.open-left-sidebar').hide(); }); } function checkUser(check,callback) { var postData = { formAction: "checkUser" }; var postUrl = "https://rmibs.co.za/api/app/login/"; //var postData = data; jQuery.post(postUrl, postData, function (data, status) { //console.log(data + 'sidebar login '); if (data == 'true') { getMenuButton(); getMenu(); $('.open-left-sidebar').show(); } else { $('.open-left-sidebar').hide(); } callback(data); //return data; }); } function logoutUser() { var data = { formAction: "logoutUser" }; var postUrl = "https://rmibs.co.za/api/app/login/"; var postData = data; jQuery.post(postUrl, postData, function (data, status) { $('.open-left-sidebar').hide(); location.reload(true); }); } function backButtonHandler(e) { if( $(".home-blocks").length > 0 ) { // Code to exit app navigator.app.exitApp(); } else { // Code to navigate to the history action //navigator.app.backHistory(); redirect('home'); } } function doredirect(loggedIn) { var action = GetURLParameter('action'); var resetPassToken = GetURLParameter('resetPassToken'); if ((resetPassToken == '') || (resetPassToken == 'undefined') || (resetPassToken == undefined) || (!resetPassToken)) { if ((action == '') || (action == 'undefined') || (action == undefined) || (!action)) { //wait for ajax call?? if (loggedIn == 'true') { action = 'home'; } else { action = 'login'; } var params = ""; } } else { action = 'forgot-password'; var params = '?resetPassToken=' + resetPassToken; } redirect(action,params); init(); } function onDeviceReady() { if (navigator.geolocation) { } else { alert('Please enable your GPS to find services and specials'); } Offline.options = { checks: {xhr: {url: 'https://rmibs.co.za/conncheck.php'}}, // to check the connection status immediatly on page load. checkOnLoad: true, // to monitor AJAX requests to check connection. interceptRequests: true, // to automatically retest periodically when the connection is down (set to false to disable). reconnect: { // delay time in seconds to wait before rechecking. initialDelay: 3, // wait time in seconds between retries. delay: 10 }, // to store and attempt to remake requests which failed while the connection was down. requests: true }; window.isRipple = (window.tinyHippos != null); window.isPhoneGap = /^file:\/{3}[^\/]/i.test(window.location.href); window.isIOS = !window.isRipple && navigator.userAgent.match(/(ios|iphone|ipod|ipad)/gi) != null; window.isAndroid = !window.isRipple && navigator.userAgent.match(/(android)/gi) != null; // these are useful later in the app, might as well set early document.addEventListener("backbutton", backButtonHandler, false); /*document.addEventListener("DOWNLOADER_initialized", function(event){ alert('initialized'); }, true); document.addEventListener("DOWNLOADER_gotFileSystem", function(event){ alert("DOWNLOADER_gotFileSystem: " + JSON.stringify(event.data, null, 4)); }, true); document.addEventListener("DOWNLOADER_gotFolder", function(event){ alert("DOWNLOADER_gotFolder: " + JSON.stringify(event.data, null, 4)); }, true); document.addEventListener("DOWNLOADER_downloadSuccess", function(event){ alert("DOWNLOADER_downloadSuccess: " + JSON.stringify(event.data, null, 4)); }, true); document.addEventListener("DOWNLOADER_error", function(event){ alert("DOWNLOADER_error: " + JSON.stringify(event.data, null, 4)); }, true); document.addEventListener("DOWNLOADER_downloadError", function(event){ alert("DOWNLOADER_downloadError: " + JSON.stringify(event.data, null, 4)); }, true); document.addEventListener("DOWNLOADER_getFileError", function(event){ alert("DOWNLOADER_getFileError: " + JSON.stringify(event.data, null, 4)); }, true);*/ $(document).on('click', '.menu-item', function() { $( ".menu-item" ).removeClass("menu-item-active"); $(this).addClass("menu-item-active"); if (jQuery(this).attr('name') !== "") { redirect(jQuery(this).attr('name')); } return false; }); $(document).on('click', '.home-blocks a', function() { redirect(jQuery(this).attr('name'),jQuery(this).data('item')); return false; }); checkUser('start',doredirect); } $( document ).ready(function() { onDeviceReady(); })