Template = new Object(); Template.is_safari = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName)?true:false; Template.is_ie55 = (document.all && document.fireEvent && !document.createComment); Template.win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); $(document).ready(function() { var resize = 0; var quickcart = 0; function testme(){ return($(".enquirypopup").hasClass("open")); } $('.totop').click(function(){ $("html, body").animate({ scrollTop: 0 }, 600); }); var openenq = function(){ return($(".enquirypopup").hasClass("open")); } if ($(".enquirypopup").hasClass("open") == true){ console.log("worked"); } $(".anatomy-and-physiology-information-manual-free-to-all-gateway-site-visitors .greentagwrap, .therapists-accounts-cd-package .greentagwrap, .hot-stone-kits-heaters .greentagwrap, .eyelash-extension-lash-lift-eyebrow-extension-and-more-products .greentagwrap").click(function( event ){ event.preventDefault(); event.stopPropagation(); $download = $("#link a").attr('href'); window.open('/newsletter'); document.location.href = $download; }); $(window).load(function(){ var slideheight = $('.slides img').height(); // console.log("Slideheight: " + slideheight); $(".slide").css("height", slideheight); var overlayheight = $('.slideinner').height(); overlayheight = overlayheight +15; $(".slideend").css("height", overlayheight ); }); $(window).scroll(function(){ //console.log("test1"); if ($(document).scrollTop() > 100 ) { $(".menutext").addClass("disme"); $(".rightmenuwrap").addClass("fixright"); } else { $(".menutext").removeClass("disme"); $(".rightmenuwrap").removeClass("fixright"); } }); var totalwidth = $(".maincontainer").width(); if (totalwidth > 660) { reducer = totalwidth / 1128; // console.log("totalwidth = " + totalwidth + " reducer = " + reducer); $(".accredimgwrap").each(function(){ startwidth = $(this).width(); startheight = $(this).height(); $(this).attr('orgwidth', startwidth); $(this).attr('orgheight', startheight); // console.log("Image width: " + startwidth); endwidth = startwidth * reducer; endheight = startheight * reducer; endheightwrap = endheight/2; newmargin = 40 * reducer; // console.log("New margin: " + newmargin); $(this).height(endheightwrap); $(this).width(endwidth); $(this).css('margin-left', newmargin); $(this).css('margin-right', newmargin); $(this).children().height(endheight); $(this).children().width(endwidth); $(this).children().css('top', endheightwrap*-1); }); } else { reducer = totalwidth / 660; $(".accredimgwrap").each(function(){ startwidth = $(this).width(); startheight = $(this).height(); $(this).attr('orgwidth', startwidth); $(this).attr('orgheight', startheight); endwidth = startwidth * reducer; endheight = startheight * reducer; endheightwrap = endheight/2; newmargin = 40 * reducer; // console.log("New margin: " + newmargin); $(this).height(endheightwrap); $(this).width(endwidth); $(this).css('margin-left', newmargin); $(this).css('margin-right', newmargin); $(this).children().height(endheight); $(this).children().width(endwidth); $(this).children().css('top', endheightwrap*-1); }); resize = 1; $(".courseaccred").each(function(){ accwidth = $(this).width(); console.log("Old Width: " + accwidth); $(this).width( accwidth/2); $(this).css('background-size', '100%'); $(this).css('background-position', 'left -41px'); $(this).css('height', '41px'); }); } $(".clickcart").click(function(){ console.log("Click " + quickcart); if (quickcart == 0){ $(".hidequickcart").css("max-height", "1200px"); quickcart = 1; } else { $(".hidequickcart").css("max-height", "0px"); quickcart = 0; } }); Custom.init(); var windowwidth = $(window).width(); windowwidth = (windowwidth - 450)/2; if (windowwidth < 0){windowwidth = 0;} $("body").find(".thanks").css('left', windowwidth); $(".mobilemenu").click(function(){ $("html, body").animate({ scrollTop: 0 }, 600); $(".navbarcontainer").addClass('open'); // $("body").addClass('slideover'); }); $(".closemobilemenu").click(function(){ $(".navbarcontainer").removeClass('open'); // $("body").removeClass('slideover'); }); $(".onecolumnonly").click(function(){ $(".rightbook").fadeIn(); }); $(".rightbook .close").click(function(){ $(this).parent().parent().fadeOut(); }); var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight; $(".wplogo").mouseenter(function(){ $(this).attr("src", "/images/worldpay_logoon.png"); }); $(".wplogo").mouseout(function() { $(this).attr("src", "/images/worldpay_logoof.png"); }); $(".paypallogo").mouseenter(function(){ $(this).attr("src", "/images/paypal_logoon.png"); }); $(".paypallogo").mouseout(function() { $(this).attr("src", "/images/paypal_logoof.png"); }); $('ul#topnav li.reallycourses > a, ul#topnav li.reallycourse::before').click(function( event ){ if (x <= 1190){ event.preventDefault(); test = $(this).parent().hasClass('opensub'); if (test == true) { $(this).parent().removeClass('opensub'); } else { $(this).parent().addClass('opensub'); } } else { } }); //$('.slides').nivoSlider({ //effect:'fade', //animSpeed:500, //startSlide:0, //directionNav:true, //controlNav:true, //keyboardNav:false, //afterChange: function(){changetext();}, //pauseOnHover:false, //pauseTime:7000 //}) $(".startopen").css({'display':'block'}); $("hr").wrap("
"); $("#contact_form #message").blur(function(){ if (this.value == ""){this.value = "Add your Enquiry here...."}; }); $("#contact_form #message").focus(function(){ if (this.value == "Add your Enquiry here...."){this.value = ""}; }); $("#contact_form #name").blur(function(){ if (this.value == ""){this.value = "Name"}; }); $("#contact_form #name").focus(function(){ if (this.value == "Name"){this.value = ""}; }); $("#contact_form #from").blur(function(){ if (this.value == ""){this.value = "E-mail"}; }); $("#contact_form #from").focus(function(){ if (this.value == "E-mail"){this.value = ""}; }); $("#contact_form #phone").blur(function(){ if (this.value == ""){this.value = "Phone"}; }); $("#contact_form #phone").focus(function(){ if (this.value == "Phone"){this.value = ""}; }); $("#contact_form #phone").blur(function(){ if (this.value == ""){this.value = "Phone"}; }); $("#contact_form #captcha").focus(function(){ if (this.value == "Please type the word(s) above here"){this.value = ""}; }); $("#contact_form #captcha").blur(function(){ if (this.value == ""){this.value = "Please type the word(s) above here"}; }); $("#contact_form #phone").focus(function(){ if (this.value == "Phone"){this.value = ""}; }); $(".search input").blur(function(){ if (this.value == ""){this.value = "Search"}; }); $(".search input").focus(function(){ if (this.value == "Search"){this.value = ""}; }); var slideheight = $('.slides img').height(); $(".slide").css("height", slideheight); var slideIndex = 0; var override = 0; var cycle = 49; carousel(); function carousel(n) { //control cycle for slides, run every 1/10 of a second // console.log("Starting"); var i; cycle++; if (cycle == 50 || override == 1) // change cycle to change duration seconds wanted * 10 { // console.log("Cycle: " + cycle + " Override: " + override); cycle = 0; var x = document.getElementsByClassName("mySlides"); for (i = 0; i < x.length; i++) { x[i].style.opacity = "0"; } if (x.length > 0){ if (override == 0){ slideIndex++; cycle = 0;}; // don't progress if this was a click if (slideIndex > x.length) {slideIndex = 1;}; if (slideIndex < 1) {slideIndex = x.length}; x[slideIndex-1].style.opacity = "1"; changetext(slideIndex -1); //used to call an external function when the animation starts running // console.log("Next slide number" + slideIndex); override = 0; } } setTimeout(carousel, 140); // Change image every 7 seconds } $( window ).resize(function() { // console.log('test: ' + testme()); var slideheight = $('.slides img').height(); $(".slide").css("height", slideheight); var overlayheight = $('.slideinner').height(); overlayheight = overlayheight +15; $(".slideend").css("height", overlayheight ); var totalwidth = $(".maincontainer").width(); var openenq = function(){ return($(".enquirypopup").hasClass("open")); } // console.log('openenq: ' + openenq); if ($(".enquirypopup").hasClass("openenq") == true){ // console.log("worked"); boxwidth3 = $(".enquirypopup").outerWidth(); boxwidth4 = (boxwidth3) -1; $(".enquirybutton").css({'left': boxwidth4}); } // $(".enquirypopup").hasClass("open").setwidth(); if (totalwidth > 660){ reducer = totalwidth / 1128; // console.log("totalwidth = " + totalwidth + " reducer = " + reducer); $(".accredimgwrap").each(function(){ startwidth = $(this).attr('orgwidth'); startheight = $(this).attr('orgheight'); console.log("Image width: " + startwidth); endwidth = startwidth * reducer; endheight = startheight * reducer; endheightwrap = endheight/2; newmargin = 40 * reducer; $(this).height(endheightwrap); $(this).width(endwidth); $(this).children().css('top', endheightwrap*-1); $(this).css('margin-left', newmargin); $(this).css('margin-right', newmargin); $(this).children().height(endheight); $(this).children().width(endwidth); }); if (resize == 1){ resize = 0; $(".courseaccred").each(function(){ accwidth = $(this).width(); console.log("Old Width: " + accwidth); $(this).width( accwidth*2); $(this).css('background-size', '100%'); $(this).css('background-position', 'left -81px'); $(this).css('height', '81px'); }); } }else{ startwidth = $(this).attr('orgwidth'); startheight = $(this).attr('orgheight'); reducer = totalwidth / 660; $(".accredimgwrap").each(function(){ startwidth = $(this).attr('orgwidth'); startheight = $(this).attr('orgheight'); console.log("Image width: " + startwidth); endwidth = startwidth * reducer; endheight = startheight * reducer; endheightwrap = endheight/2; newmargin = 40 * reducer; $(this).height(endheightwrap); $(this).width(endwidth); $(this).children().css('top', endheightwrap*-1); $(this).css('margin-left', newmargin); $(this).css('margin-right', newmargin); $(this).children().height(endheight); $(this).children().width(endwidth); }); if (resize == 0){ resize = 1; $(".courseaccred").each(function(){ accwidth = $(this).width(); console.log("Old Width: " + accwidth); $(this).width( accwidth/2); $(this).css('background-size', '100%'); $(this).css('background-position', 'left -41px'); $(this).css('height', '41px'); }); } } }); window.carouselclick = function(n){ // console.log("Click detected, old slide index: " + slideIndex); override = 1; // this tells the control cycle to exit current sequence, change the image, then reset to 5 seconds slideIndex = slideIndex + n; } // Drop down box for venues page // Set the state to closed on load state="closed"; $(".enquirybutton, #close").click(function(){ boxwidth = $(".enquirypopup").outerWidth(); boxwidth2 = (boxwidth * -1) -4; if (state == "closed"){ // If its not already open, then open it $(".enquirypopup").css({'transition':'left 1s ease-in-out 0s'}); $(".enquirypopup").css({'left':'0px'}); $(".enquirybutton").css({'transition':'left 1s ease-in-out 0.25s'}); $(".enquirybutton").css({'left': boxwidth}); state="open"; $(".enquirypopup").addClass("openenq"); } else{ // Check if its open, if so close it $(".enquirypopup").css({'transition':'left 1s ease-in-out 0.25s'}); $(".enquirybutton").css({'transition':'left 1s ease-in-out 0s'}); $(".enquirybutton").css({'left':'0px'}); $(".enquirypopup").css({'left': boxwidth2}); state="closed"; $(".enquirypopup").removeClass("openenq"); } }); function jump(newlocation, locname){ $(".venuelist .select").innerHtml=locname; alert(locname & ' ' & newlocation); // window.location.replace( newlocation ); } $(".venuelist select").change(function(){ // alert($(".venuelist select option:selected").attr("value")); bob = $(".venuelist select option:selected").text(); $(".venuelist .select").text(bob); window.location.replace( $(".venuelist select option:selected").attr("value") ); }); $(".testimonials select").change(function(){ // alert($(".venuelist select option:selected").attr("value")); bob = $(".testimonials select option:selected").text(); $(".testimonials .select").text(bob); window.location.replace( $(".testimonials select option:selected").attr("value") ); }); $("#tabbutton1").click(function(){ $("#tab1").css('display', 'block'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'none'); $("#tab6").css('display', 'none'); $("#tabbutton1").addClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").removeClass('active'); $("#tabbutton6").removeClass('active'); }); $("#tabbutton2").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'block'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'none'); $("#tab6").css('display', 'none'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").addClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").removeClass('active'); $("#tabbutton6").removeClass('active'); }); $("#tabbutton3").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'block'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'none'); $("#tab6").css('display', 'none'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").addClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").removeClass('active'); $("#tabbutton6").removeClass('active'); }); $("#tabbutton4").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'block'); $("#tab5").css('display', 'none'); $("#tab6").css('display', 'none'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").addClass('active'); $("#tabbutton5").removeClass('active'); $("#tabbutton6").removeClass('active'); }); $("#tabbutton5").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'block'); $("#tab6").css('display', 'none'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").addClass('active'); $("#tabbutton6").removeClass('active'); }); $("#tabbutton6").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'none'); $("#tab6").css('display', 'block'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").removeClass('active'); $("#tabbutton6").addClass('active'); }); $(".openaccred").click(function(){ $("#tab1").css('display', 'none'); $("#tab2").css('display', 'none'); $("#tab3").css('display', 'none'); $("#tab4").css('display', 'none'); $("#tab5").css('display', 'block'); $("#tab6").css('display', 'none'); $("#tabbutton1").removeClass('active'); $("#tabbutton2").removeClass('active'); $("#tabbutton3").removeClass('active'); $("#tabbutton4").removeClass('active'); $("#tabbutton5").addClass('active'); $("#tabbutton6").removeClass('active'); $("html, body").animate({ scrollTop: 0 }, 600); }); $(".feedback").click(function(event){ $(this).siblings('.hiddenfeedback').css('max-height', '400px'); }); $(".closefeedback").click(function(event){ $(this).parent('.hiddenfeedback').css('max-height', '0px'); }); $("a.bookmark").click(function(e){ e.preventDefault(); // this will prevent the anchor tag from going the user off to the link var bookmarkUrl = this.href; var bookmarkTitle = this.title; if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { alert("This function is not available in Google Chrome. Click the star symbol at the end of the address-bar or hit Ctrl-D (Command+D for Macs) to create a bookmark."); }else if (window.sidebar) { // For Mozilla Firefox Bookmark window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,""); } else if( window.external || document.all) { // For IE Favorite window.external.AddFavorite( bookmarkUrl, bookmarkTitle); } else if(window.opera) { // For Opera Browsers $("a.bookmark").attr("href",bookmarkUrl); $("a.bookmark").attr("title",bookmarkTitle); $("a.bookmark").attr("rel","sidebar"); } else { // for other browsers which does not support alert('Your browser does not support this bookmark action'); return false; } }); $(".continue").click(function(){ $("body").scrollTop(500); }); $("a[rel^='prettyPhoto']").prettyPhoto(); var mainheight = $(".rightcolumn").height(); var mainheight = mainheight - 112; $(".leftcentermarker").height(mainheight); var mainheight2 = $(".rightbook").height(); var mainheight2 = mainheight2 - 112; $(".leftborder .middle").height(mainheight2); var checkheight = function() { if (this.height <= '30') { this.css('margin-top', '5px'); this.css('margin-bottom', '5px'); this.height(30); } else { this.height(40); } } $(".downloads h5").height(function() { if ($(this).height() <= '30') { $(this).css('margin-top', '12px'); $(this).css('margin-bottom', '3px'); $(this).height(30); } else { $(this).height(40); $(this).css('margin-top', '5px'); $(this).css('margin-bottom', '0px'); } }); $(".thanks .close").click(function(){ $(this).parent().fadeOut(); }); $(".infobut1").click(function(){ $(".info1").fadeIn(); }); $(".infobut2").click(function(){ $(".info2").fadeIn(); }); // Nasty hack to keep the radio buttons "checked" on the downloads page // Likely better to just have hidden input tags with static image of different coloured clicked checkbox // (easier and better from a usability perspective) $(".downloads .rightcolumn").bind("click", function(event){ $input = $(event.target).next(); if ($input) { if (($input.attr("name") == "static_pages[3313]") || ($input.attr("name") == "static_pages[35]")){ $input.attr('checked', true); // radioHeight is a global variable $(event.target).css({'backgroundPosition' : "0 -" + radioHeight*2 + "px"}); } } }); $(".course_notes").click(function(){ $(this).find(".course_notes_details").css('display', 'block'); }); var acceptedterms = 0; $("#termsbox").click(function(){ if (acceptedterms == '0'){ $(".finalbuttonhidden").css('display', 'block'); $(".finalbuttonhiddenfalse").css('display', 'none'); $("#termsbox").css('background-position', '0px -86px'); acceptedterms = '1'; }else if(acceptedterms == '1'){ $(".finalbuttonhidden").css('display', 'none'); $(".finalbuttonhiddenfalse").css('display', 'block'); $("#termsbox").css('background-position', '0px 0px'); acceptedterms = '0'; } }); $(".finalbuttonhiddenfalse").click(function(){ $(".acceptterms").css('display', 'block'); }); // ---------- // register page // ---------- var displayPrivacy = function() { if ($("#acceptprivacy").val() != '') { $("#privacybox").css('background-position', '0px -86px'); } else { $("#privacybox").css('background-position', '0px 0px'); } $("#erroracceptprivacy").hide(); if ($("#erroracceptprivacy > span").length) { $("#erroracceptprivacy").show(); } }; $("#privacybox").click(function(){ if ($("#acceptprivacy").val() != '') { $("#acceptprivacy").val(''); } else { var d = new Date(); $("#acceptprivacy").val(d.toISOString()); } displayPrivacy(); }); displayPrivacy(); // ---------- // checkout page // ---------- $('a[id^="update-quantity-"]').click(function() { $(this).closest('form').submit(); return false; }); $('a[id^="remove-"]').click(function() { key = ($(this).attr('id').split("-"))[2]; $('input[name="items[' + key + '][item_qty]"]').val(0); $(this).closest('form').submit(); return false; }); // submit the form if manual clicked $('span.checkbox,input[id^="check-manual-"]').on('click', function() { $element = $(this).next(); if($(element).is('span')) { $element = $element.next(); } split_id = $element.attr('id').split("-"); entry_id = split_id[2]; qty_in_cart = parseInt(split_id[3], 10); // remove the item if already checked if (! $element.is(':checked')) { $('#item_qty_' + entry_id).val(-1 * qty_in_cart); } $(this).closest('form').submit(); }); $.ajax({ type: "POST", dataType: "json", url: "/?ACT=81", success: function(data) { json_data = JSON.stringify(data); _(data.items).each(function(item){ $element = $('input[id^="check-manual-' + item.entry_id + '"]'); $element.prop('checked', true); // only show manual header check if the element exists and is checked if ($element.is(':checked')) { $('#manuals-cart-header').show(); } }); } }); }); jQuery.fn.extend({ setwidth: function() { boxwidth = $(".enquirypopup").outerWidth(); boxwidth2 = (boxwidth * -1) -4; $(".enquirybutton").css({'left': boxwidth2}); console.log("boxwidth2"); } });