//Bubble/popup function $(function () { $('.bubbleInfo').each(function () { // options var distance = 10; var time = 250; var hideDelay = 500; var hideDelayTimer = null; // tracker var beingShown = false; var shown = false; var trigger = $('.trigger', this); var popup = $('.popup', this).css('opacity', 0); // set the mouseover and mouseout on both element $([trigger.get(0), popup.get(0)]).mouseover(function () { // stops the hide event if we move from the trigger to the popup element if (hideDelayTimer) clearTimeout(hideDelayTimer); // don't trigger the animation again if we're being shown, or already visible if (beingShown || shown) { return; } else { beingShown = true; // reset position of popup box popup.css({ top: -100, left: -33, display: 'block' // brings the popup back in to view }) // (we're using chaining on the popup) now animate it's opacity and position .animate({ top: '-=' + distance + 'px', opacity: 1 }, time, 'swing', function() { // once the animation is complete, set the tracker variables beingShown = false; shown = true; }); } }).mouseout(function () { // reset the timer if we get fired again - avoids double animations if (hideDelayTimer) clearTimeout(hideDelayTimer); // store the timer so that it can be cleared in the mouseover if required hideDelayTimer = setTimeout(function () { hideDelayTimer = null; popup.animate({ top: '-=' + distance + 'px', opacity: 0 }, time, 'swing', function () { // once the animate is complete, set the tracker variables shown = false; // hide the popup entirely after the effect (opacity alone doesn't do the job) popup.css('display', 'none'); }); }, hideDelay); }); }); }); $(document).ready(function(){ $("ul.subnav").parent().append(""); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*) $("ul.topnav li span").click(function() { //When trigger is clicked... //Following events are applied to the subnav itself (moving subnav up and down) $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click $(this).parent().hover(function() { }, function(){ $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up }); //Following events are applied to the trigger (Hover events for the trigger) }).hover(function() { $(this).addClass("subhover"); //On hover over, add class "subhover" }, function(){ //On Hover Out $(this).removeClass("subhover"); //On hover out, remove class "subhover" }); }); function verifyDelete(title){ var msg = "Are you sure you want to delete '" + title + "'?"; return confirm(msg); } function verifySendEmails(){ var msg = "Are you sure you want to send the selected emails to all subscribers?"; return confirm(msg); } function disableSubmit(){ for(i = 0; i < document.forms[0].elements.length; i++){ var ele = document.forms[0].elements[i]; if(ele.type.toLowerCase() == "submit"){ ele.disabled = true; } } } function disableNames(){ var ele = document.getElementById('txt_nme_frst_fac'); ele.disabled = true; ele = document.getElementById('txt_nme_lst_fac'); ele.disabled = true; } function updatePhone(field){ var inPhone = field.value; var phone = ""; var i; for(i = 0; i < inPhone.length; i++){ if((inPhone.substr(i, 1) == "0") || (inPhone.substr(i, 1) == "1") || (inPhone.substr(i, 1) == "2") || (inPhone.substr(i, 1) == "3") || (inPhone.substr(i, 1) == "4") || (inPhone.substr(i, 1) == "5") || (inPhone.substr(i, 1) == "6") || (inPhone.substr(i, 1) == "7") || (inPhone.substr(i, 1) == "8") || (inPhone.substr(i, 1) == "9")){ phone += inPhone.substr(i, 1); } } switch(phone.length){ case 0: // do nothing break; case 1: case 2: // add ( in front; phone = "(" + phone; break; case 3: case 4: case 5: // add ( in front, ) after 5 characters phone = "(" + phone.substr(0, 3) + ") " + phone.substr(3); break; case 6: case 7: case 8: case 9: case 10: // add ( in front, ) after 5 chars, - after 9 chars phone = "(" + phone.substr(0, 3) + ") " + phone.substr(3, 3) + "-" + phone.substr(6); break; default: break; } field.value = phone; }