var defaultOmniture=true; //used for omniture reporting var clickedForm=0; //used for commercial, government landing page form // used for link tracking var pageUrl = String(window.location), s_account=""; if (pageUrl.indexOf("perf")!=-1 || pageUrl.indexOf("dev")!=-1) { s_account="adtcomperf"; } else { s_account="adtcorpprod,adtcomprod"; } function setSocialMediaBar() { if (document.getElementById('news')) {document.getElementById('news').style.display="none";} document.getElementById('socialMediaBar').style.display="block"; } // used to activate specific tab function setActiveTab(x) { $("#tabs h1").removeClass("active"); $("#content .tab_content").hide(); if (x==1) { $("#tabs h1.first").addClass("active").show(); $("#content #tab1").show(); } else if (x==2) { $("#tabs h1.second").addClass("active").show(); $("#content #tab2").show(); } else { $("#tabs h1.third").addClass("active").show(); $("#content #tab3").show(); } } // jquery plugin used for social feeds (function($){ $.extend({ jGFeed : function(url, fnk, num, key){ if(url == null) return false; var gurl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+encodeURIComponent(url); //console.debug("gurl %s", gurl); if(num != null) gurl += "&num="+num; if(key != null) gurl += "&key="+key; $.getJSON(gurl, function(data){ //console.debug("data %o", data); try { if(typeof fnk == 'function'){fnk.call(this, data.responseData.feed);} } catch(e) { //console.debug("error %d url %s", num, gurl); var errorText = "

There is currently no information at this time. Please check later.

" if (gurl.search(/Facebook/ig) > 0 ){ $('#facebook-feedlist .scroll-pane').append(errorText); } else if (gurl.search(/Twitter/ig) > 0){ $('#twitter-feedlist .scroll-pane').append(errorText); } else if (gurl.search(/Youtube/ig) > 0){ $('#youtube-feedlist').append(errorText); } else if (gurl.search(/adtcommercialsecurity/ig) > 0 || gurl.search(/homesecuritysource/ig) > 0){ $('#blog-feedlist .scroll-pane').append(errorText); } return false; } } ); } }); })(jQuery); function loadSocialFeed(feedURL,ID) { //console.log('feedURL: '+feedURL); $.jGFeed(feedURL, function(feeds){ //console.debug("feeds %o", feeds); if(!feeds){ // there was an error return false; } var feedList = ""; var urlText = "Read more"; var data=feeds.entries; //Set the starting part of the URL if (ID==1){ var url = ""; } else if (ID==2){ var url = ""; } else if (ID==3){ var url = ""; urlText = "Watch video"; } else { var url = ""; } // Populate the feed containers with feed data /* if (ID==3 && channel != "Home") { var videoURL = feeds.entries[0].link; var videoTitle = feeds.entries[0].title; var videoSnippet = feeds.entries[0].contentSnippet; var videoDescr = feeds.entries[0].content; // set a different URL and return the anchor string var videoID = jQuery.url.setUrl(videoURL).param("v"); // get the value for the "video" query parameter console.log(videoID); feedList = "" + "" // For video shown inside a light box and on landing pages if(($("#lgVideo").length != 0) || ($("#tier1").length != 0)){ feedList = "" + "" +"
"+data[0].contentSnippet+"" +" " + urlText + "
"; } if (($('.tab-commercial').length != 0) || ($('.tab-government').length != 0)) { feedList = "" + "" ; } } else { */ feedList = ""; //} // Insert Feed Data into HTML and add custom scroll if (ID==1){ $('#socialMedia #fbtab .mediaFeed, #facebook-feedlist .scroll-pane, #fb-modal .scroll-pane').append(feedList); $('#socialMedia #fbtab .mediaFeed, #facebook-feedlist .scroll-pane, #fb-modal .scroll-pane').jScrollPane(); } else if (ID==2){ $('#socialMedia #twtab .mediaFeed, #twitter-feedlist .scroll-pane, #tw-modal .scroll-pane').append(feedList); } else if (ID==3){ //if (($('.tab-commercial').length != 0) || ($('.tab-government').length != 0)) { // $('.social_tab_content.youtube .vid').append(feedList); //} //else { $('#socialMedia #yttab .mediaFeed, #youtube-feedlist .scroll-pane, #yt-modal .scroll-pane').append(feedList); //} //$('.video-txt h3').append(videoTitle); //$('.video-txt p').append(videoSnippet); } else { $('#socialMedia #bltab .mediaFeed, #blog-feedlist .scroll-pane, #blog-modal .scroll-pane').append(feedList); } }, 10); } // jquery plugin used for search box $.fn.clearSearch = function(){ return this.focus(function(){ if (this.value == this.defaultValue){ this.value = ""; } }).blur(function() { if (!this.value.length) { this.value = this.defaultValue; } }); }; // accordion script used for menus in tier 1/2 var Accordion = function(container) { var container = container, triggers = container.children('.trigger'), triggerMinuses = triggers.children('span'), targets = container.children('.target'), activeClass = 'active', minusClass = 'minus'; triggers.click(function() { var req = $(this); if (req.next().is(':hidden')) { triggers.removeClass(activeClass).next().slideUp(400, function() { triggerMinuses.removeClass(minusClass); }); req.addClass(activeClass).next().slideDown(550, function() { req.next('.target').addClass(activeClass).end().children('span').addClass(minusClass); }); } else { triggers.removeClass(activeClass).next().slideUp(400, function() { triggerMinuses.removeClass(minusClass); }); } return false; }); }; // drop down functionality for my account submenu var MyAccount = function() { var trigger = $('.my-account'); var target = $('.my-account-menu'); var overlay = $('#overlay-my-account'); var docHeight = {}; function toggleMyAccount() { target.toggle(); trigger.toggleClass('my-account-expanded'); docHeight = $(document).height(); overlay.toggle().css("height", docHeight); } trigger.click(function(){toggleMyAccount();}); overlay.click(function(){toggleMyAccount();}); } function setButtonOmniture(x){ var s=s_gi(s_account); s.linkTrackVars='prop7,prop9,prop10,prop13,eVar7,eVar9,eVar10,eVar13,events'; s.linkTrackEvents='event2'; s.prop7=activeDnis; s.eVar7=s.prop7; s.prop9=activeDivision; s.eVar9=s.prop9; if (x==1) { s.prop10='Lead Form'; s.prop13='Lead'; } else { s.prop10='Contact Form'; s.prop13='Contact'; } s.eVar10=s.prop10; s.eVar13=s.prop13; s.events='event2'; s.tl(this,"o",s.pageName+":view form"); //reset variables s.linkTrackVars='pev2'; s.linkTrackEvents=null; s.prop7=null; s.eVar7=s.prop7; s.prop9=null; s.eVar9=s.prop9; s.prop10=null; s.eVar10=s.prop10; s.prop13=null; s.eVar13=s.prop13; s.events=null; } var FormSlider = function(){ var buttonClicked=0; $("#form.tab-commercial").click(function(){ if (clickedForm==0) { setSuperForm("#contactForm",superForm11); clickedForm=1; } $("#contactForm").slideToggle("slow"); if (buttonClicked==0) { setButtonOmniture(1); buttonClicked=1; } else { buttonClicked=0; } return false; }); $("#form.tab-government").click(function(){ if (clickedForm==0) { setSuperForm("#contactForm",superForm12); clickedForm=1; } $("#contactForm").slideToggle("slow"); if (buttonClicked==0) { setButtonOmniture(1); buttonClicked=1; } else { buttonClicked=0; } return false; }); }; var Testimonials = function() { var slideIndex = 0; var nextIndex = 0; var prevIndex = 0; $('#testimonial-slide ul').cycle({ fx: 'fade', timeout: 0, speed: 500, easingIn:0, easingOut:0, after: function(currSlideElement, nextSlideElement, options) { slideIndex = options.currSlide; nextIndex = slideIndex + 1; prevIndex = slideIndex -1; if (slideIndex === options.slideCount-1) { nextIndex = 0; } if (slideIndex === 0) { prevIndex = options.slideCount-1; } } }); $('#leftControl').click(function () { $('#testimonial-slide ul').cycle(nextIndex, "scrollRight"); return false; }); $("#rightControl").click(function () { $('#testimonial-slide ul').cycle(prevIndex, "scrollLeft"); return false; }); } function filterEvents(x) { if (x==1) { var industry = $('#filterMonth').val(); } else { var industry = $('#filterYear').val(); } var totalCount =0; if ($('.article .no-industry').length) {$('.article .no-industry').hide();} $('.div-central').each(function() { var postClass = $(this).attr('class'); if (industry!="all") { if (postClass.indexOf(industry)==-1) { $(this).hide(); } else { $(this).show(); totalCount=1; } } else { $(this).show(); totalCount=1; } }); if (totalCount==0) { if (industry=='jan') {industry='January';} else if (industry=='feb') {industry='February';} else if (industry=='mar') {industry='March';} else if (industry=='apr') {industry='April';} else if (industry=='may') {industry='May';} else if (industry=='jun') {industry='June';} else if (industry=='jul') {industry='July';} else if (industry=='aug') {industry='August';} else if (industry=='sep') {industry='September';} else if (industry=='oct') {industry='October';} else if (industry=='nov') {industry='November';} else if (industry=='dec') {industry='December';} if (!$('.article .no-industry').length) { $('.article').append('
'); $('.article .no-industry').html('

There are no '+industry+' events at this time.

'); } else { $('.article .no-industry').html('

There are no '+industry+' events at this time.

').show(); } } } function filterIndustryPage(x) { var industry = x; $('.sup-box ul.list-gral li').each(function() { var postClass = $(this).attr('class'); if (postClass.indexOf(industry)!=-1) { $(this).show(); } }); $('.sup-box ul.list-gral').each(function() { var liCount=0; if ($(this).find('li').is(":visible")) { liCount=1; } if (liCount==0) { $(this).parent().append('

Coming Soon!

'); } }); } function filterGovIndustry() { $('.div-central').each(function() { var postClass = $(this).attr('class'); if (postClass.indexOf('government')!=-1) { $(this).show(); } }); } function filterIndustry(x) { var industry = $('#choose-industry').val(); var totalCount =0; var area = x; if ($('.article .no-industry').length) {$('.article .no-industry').hide();} $('.div-central').each(function() { var postClass = $(this).attr('class'); if (industry!="all") { if (postClass.indexOf(industry)==-1) { $(this).hide(); } else { $(this).show(); totalCount=1; } } else { $(this).show(); totalCount=1; } }); if (totalCount==0) { if (industry == "banking") {industry="Banking & Financial";} else if (industry == "chemical") {industry="Chemical & Petrochemical";} else if (industry == "food") {industry="Food Defense";} else if (industry == "business") {industry="General Business";} else if (industry == "healthcare") {industry="Healthcare & Pharmaceutical";} else if (industry == "transportation") {industry="Transportation & Logistic";} else if (industry == "integration") {industry="Advanced Integration";} else if (industry == "burglary") {industry="Burglary Protection";} else if (industry == "theft") {industry="Employee Theft";} else if (industry == "fire") {industry="Fire and Smoke Detection";} else if (industry == "flood") {industry="Flood Detection";} else if (industry == "fraud") {industry="Fraud Detection";} else if (industry == "intrusion") {industry="Intrusion Detection";} else if (industry == "loss") {industry="Loss Detection";} else if (industry == "unauthorized") {industry="Unauthorized Entry";} if (!$('.article .no-industry').length) { $('.article').append('
'); $('.article .no-industry').html('

'+industry+' '+area+' Coming Soon!

'); } else { $('.article .no-industry').html('

'+industry+' '+area+' Coming Soon!

').show(); } } } $(document).ready(function() { //Commercial Resource Center $('.box-links').jScrollPane(); $('.trigger-form').click(function() {$(this).toggleClass("active");$('.superForm').slideToggle();}); //Commercial Industry Tabs if ($('#tabx').length) { $("#tabx").tabs(); } if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))) { //$('#video-player #text-7').hide(); //$('#video-player #noflash').show(); } else { if (navigator.appName == 'Microsoft Internet Explorer') { $('#video-player #text-7').hide(); $('#video-player #noflash').show(); } } if ($('#contactForm')) { FormSlider(); }; if ($('#testimonial-slide')) { Testimonials(); }; // clear search box on focus $(".input-text").clearSearch(); // Highlights selected tab var path = window.location.pathname; var tabIndex; if(path.indexOf("home-security") != -1) { tabIndex = 0; } else if(path.indexOf("small-business-security") != -1) { tabIndex = 1; } else if(path.indexOf("commercial-security") != -1) { tabIndex = 2; } else if(path.indexOf("government") != -1) { tabIndex = 3; } $('#navigation ul#root > li').eq(tabIndex).addClass("active"); // navigation hover popup $("#navigation ul li").hover(function() { $(this).children(".subnav").css("display", "block"); $(this).addClass("hovered"); },function() { $(this).removeClass("hovered"); $(this).children(".subnav").css("display", "none"); }); // handles special css styles for form elements $(".region").jqTransform(); // fix for top hover menus z-index in IE 6-7 if ($.browser.msie && $.browser.version <= parseInt("7.0")) { var zIndexNumber = 1000; $('#overlay-my-account, #header, #header div, #navigation, #navigation div').each(function() { $(this).css('zIndex', zIndexNumber); zIndexNumber -= 10; }); } // news slider - uses jquery cycle $("#news ul").cycle({ fx: "scrollLeft", speedOut: -1000, speedIn: 500, timeout: 5000 }); // content tabs $("#tabs h1 a").click(function() { $("#tabs h1").removeClass("active"); // remove any "active" class $(this).parent().addClass("active"); // add "active" class to selected tab $("#content .tab_content").hide(); // hide all tab content var activeTab = $(this).attr("href"); // find the href attribute value to identify the active tab + content $(activeTab).fadeIn("fast"); // fade in the active ID content return false; }); //fix for facebook social media box $("#tabs h1.first a").click(function() { $('#socialMedia ul.tabs li#fb').click(); }); // set link tracking on home page tabs $("#tabs h1.first a").attr("onClick","var s=s_gi('"+s_account+"');s.linkTrackVars='pev2';s.linkTrackEvents=null;s.events=null;s.tl(this,'o','"+s.pageName+":TabbedContent:HomeSecurity');"); $("#tabs h1.second a").attr("onClick","var s=s_gi('"+s_account+"');s.linkTrackVars='pev2';s.linkTrackEvents=null;s.events=null;s.tl(this,'o','"+s.pageName+":TabbedContent:SMB');"); $("#tabs h1.third a").attr("onClick","var s=s_gi('"+s_account+"');s.linkTrackVars='pev2';s.linkTrackEvents=null;s.events=null;s.tl(this,'o','"+s.pageName+":TabbedContent:Commercial');"); $('#socialMedia ul.tabs li a').click(function(e) { e.preventDefault(); }); $('#socialMedia ul.tabs li').each(function() { $(this).click(function() { var tab = $(this).attr("id"); $('#socialMedia .tab').css("display","none"); $('#socialMedia ul.tabs li').removeClass("active border"); if (tab!="fb") {$(this).prev().addClass("border");} $(this).addClass("active"); $('#socialMedia #'+tab+'tab').fadeIn("fast"); $('#socialMedia #'+tab+'tab .mediaFeed').jScrollPane(); }); }); // video selector if ($(".video-selector").length > 0) { $(".video-selector .video-target:first").css("display", "block"); $(".video-selector .video-controller").click(function() { $(".video-selector .video-controller").each(function() { $(this).removeClass("active-vid"); }); $(this).addClass("active-vid"); var vidTarget = $(this).attr("title"); $(".video-selector .video-target").each(function() { var vidId = $(this).attr("id"); if (vidId == vidTarget) { $(this).css("display", "block"); } else { $(this).css("display", "none"); } }); }); } // redirect the browser to the selected region $("div.region div.jqTransformSelectWrapper ul li a").click(function(){ var index = $(this).attr('index'); var value = $('select.jqTransformHidden option:eq('+index+')').attr('value'); window.open(value); return false; }); new Accordion($('#mb-accordion')); // create accordion tier 2 middle menu new Accordion($('.accordion-nav')); // create accordion tier 2 left menu new MyAccount(); // create my account handler // social media bar click $("ul#soctabs_tier2_list li").click(function() { var docHeight = $(document).height(); if ($.browser.msie && $.browser.version <= parseInt("7.0")) { $("#overlay").hide(); } else { $("#overlay").fadeIn(25).css("height", docHeight); } $("div.modal-soctab").each(function() { $(this).removeClass("show"); }); $(this).find("div.modal-soctab").addClass("show"); $("ul#soctabs_tier2_list li").each(function() { $(this).css("z-index", 2002); }); $(".scroll-pane").jScrollPane(); }); // hide social tab when close button clicked $("ul#soctabs_tier2_list li .btn-close a").click(function() { $("div.modal-soctab").each(function() { $(this).removeClass("show"); }); $("#overlay").fadeOut(25); return false; }); // hide social tab when the user clicks anywhere on the page $("#overlay").click(function() { $("div.modal-soctab").each(function() { $(this).removeClass("show"); }); $("#overlay").fadeOut(25); return false; }); // activate first social tab $(".social_tab_content").hide(); //hide all content $("ul.social_tabs li:first").addClass("active").show(); //activate first tab $(".social_tab_content:first").show(); //show first tab content $("ul.social_tabs li").click(function() { if (!$(this).hasClass("soc-tab-compensate-x")) { $("ul.social_tabs li").removeClass("active-soctab"); //Remove any "active" class $("ul.social_tabs li").removeClass("before-active-soctab"); $(this).addClass("active-soctab"); //Add "active" class to selected tab $(this).prev().addClass("before-active-soctab"); $(".social_tab_content").hide(); //Hide all tab content var activeSocialTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeSocialTab).fadeIn(); //Fade in the active ID content $(activeSocialTab).find("div.scroll-pane").jScrollPane(); return false; } }); $(this).prev().find("div.separator").add("div.separator"); //Add "active" class to selected tab // load social feeds if ($('#page-wrap').hasClass('tab-commercial') || $('#page-wrap').hasClass('tab-government')) { loadSocialFeed('http://www.facebook.com/feeds/page.php?format=atom10&id=138940016164508',1); loadSocialFeed('http://twitter.com/statuses/user_timeline/89017635.rss',2); loadSocialFeed('http://gdata.youtube.com/feeds/api/playlists/D404D84CC6614A68',3); loadSocialFeed('http://www.adtcommercialsecurity.com/feed',4); } else if ($('#page-wrap').hasClass('tab-smallbusiness')) { loadSocialFeed('http://www.facebook.com/feeds/page.php?format=atom10&id=40851522417',1); loadSocialFeed('http://twitter.com/statuses/user_timeline/86143723.rss',2); loadSocialFeed('http://gdata.youtube.com/feeds/api/users/adt/uploads',3); loadSocialFeed('http://www.securityforsmallbusiness.com/rss.aspx',4); } else { loadSocialFeed('http://www.facebook.com/feeds/page.php?format=atom10&id=40851522417',1); loadSocialFeed('http://twitter.com/statuses/user_timeline/86143723.rss',2); loadSocialFeed('http://gdata.youtube.com/feeds/api/users/adt/uploads',3); loadSocialFeed('http://www.homesecuritysource.com/rss.aspx',4); } // Home Security - Compare packages page if ($('table.table-round').length>0) { $('table.table-round .hasDescr .td-body-item a').click(function () { var _this = $(this); var _parent = _this.parent(); if( !_parent.hasClass('td-body-item-show') ){ _parent.addClass('td-body-item-show'); } else{ _parent.removeClass('td-body-item-show'); } return false; }); } }); // jquery plugin for simpler jquery ui dialog handling (function($){ $.fn.dialogbgt = function(options) { defaults = { ui: '1.8', // jQuery UI version height: 500, // Dialog height width: 700, // Dialog width iheight: 1430, // iFrame height. Not used when cssIframe is set to true iwidth: 674, // iFrame width. Not used when cssIframe is set to true preventHeight: true, // Prevent iFrame from being larger than dialog window. Prevents double scrollbar. url: '', // Use to set a different URL. The href will be passed as a parameter title: '', // Use to set a different Title. loadJui: true, // Load the jquery UI css cssIframe: false, // Use external styles for ifrmae showTitle: true, // Show the Dialog title bar. When set to false the close icon won't show as well. Be sure to add your own close method closeDialog: '', // Set the class used to close the dialog box. Useful for when you want to set your own close button autoOpen: false // Open the dialig immedietly }; options = $.extend(defaults, options); var nonregoptions = ['iwidth','iheight'], // Stores options not used for the dialog heightchange, attributes, prop, attr, title, newOptions = [], iframe = '
'; // Insert jQuery UI CSS if(options.loadJui){ var head = $("head"), // Get the document's head tag style = document.createElement('link'), // Create a link element url = "http://ajax.googleapis.com/ajax/libs/jqueryui/"+options.ui+"/themes/base/jquery-ui.css"; // jQuery UI CSS url if (!isLoaded(head, 'link', 'href', url)) { style.href = url; style.rel = "stylesheet"; style.type = "text/css"; head.append(style); } } // Insert the dialog window html $("body").append(iframe); // Call the dialog UI method $("#bgt-dialog-window").dialog({ autoOpen: options.autoOpen, modal: true, resizable: false, height: options.height, width: options.width }); // Set a clear content on dialog close. Prevents old content from flashing when reusing the Dialog $('.ui-dialog-titlebar-close').click(function(){ $('#bgt-dialog-frame').attr("src", ''); // Remove dialog content }); return this.each(function() { if(options.autoOpen){ setme(); }else{ $(this).click(function(){ setme(); return false; }); } }); function setme(){ if (options.url != "") { url = options.url; if(($(this).attr('href') != "")&&($(this).attr('href') != undefined)){ url += "?url=" + $(this).attr('href'); } $("#bgt-dialog-frame").attr('data-url', $(this).attr('href')); } else { url = $(this).attr('href'); } $('#bgt-dialog-frame').attr("src", url); // Set the dialog content to the href property of the link if(options.closeDialog != ""){ $('#bgt-dialog-frame').load(function(){ // Wait for iframe to load $("#bgt-dialog-frame").contents().find("."+options.closeDialog).click(function(){ // Look for the element with the specific class name and bind the onClick event window.parent.jQuery("#bgt-dialog-window").dialog("close"); // Bind the close method $('#bgt-dialog-frame').attr("src", ''); // Remove dialog content }); }); } if(options.showTitle){ if(options.title != ""){ title = options.title; }else{ title = $(this).attr('title'); } $("#ui-dialog-title-bgt-dialog-window").html(title); // Set the dialog title to the title property of the link }else{ $(".ui-dialog-titlebar").css({'display':'none'}); } if(!options.cssIframe){ $('#bgt-dialog-frame').attr('style', 'height: '+options.iheight+'px; width: '+options.iwidth+'px; border: none'); } attributes = $(this).attr('rel'); if((attributes != "")&&(attributes != undefined)){ // Link has it's own specific options attr = attributes.split(';'); // Create array of attributes for(var item in attr){ prop = item.split("="); newOptions[prop[0]] = prop[1]; // replace options with the ones from the attributes /* Set dialog options ignoring the ones defined for other elements */ if(!(prop[0] in oc(nonregoptions))){ $("#bgt-dialog-window").dialog('option',prop[0],prop[1]); } } $('#bgt-dialog-frame').attr('style', 'height: '+newOptions['iheight']+'px; width: '+newOptions['iwidth']+'px'); // Change dialog iframe size heightchange = newOptions['iheight']; }else{ $("#bgt-dialog-window").dialog({ 'width':options.width, 'height':options.height }); heightchange = options.iheight } if(options.preventHeight){ var titleheight, diff, newheight; // The variables above are used to caluclate height different between the iframe and the dialog window titleheight = Math.ceil($('.ui-dialog-titlebar').height()); diff = options.height - heightchange - titleheight - 80; // Get the height differnce between the dialog, dialog title and the iframe if(diff < 0){ newheight = heightchange + diff; // Height difference is added since it is already a negative number $('#bgt-dialog-frame').attr('style', $('#bgt-dialog-frame').attr('style').replace(heightchange, newheight)); } } $("#bgt-dialog-window").dialog('open'); } // Check to see if CSS file is already on the head to prevent loading it twice function isLoaded(container, tagName, propKey, propValue) { var elems = container; var alreadyLoaded = false; for (var i = 0, elem; elem = elems[i]; i++) { if (elem[propKey] == propValue) { alreadyLoaded = true; break; } } return alreadyLoaded; }; // Check if value exists in array function oc(a){ var o = {}; for(var i=0;i