var defaultOmniture=true; //used for omniture reporting // 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="adtcomprod"; } function setSocialMediaBar() { 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 = "http://www.facebook.com"; } 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; var triggers = container.children('.trigger'); var triggerMinuses = triggers.children('span'); var targets = container.children('.target'); var activeClass = 'active'; var minusClass = 'minus'; triggers.click(function() { if ($(this).next().is(':hidden')) { triggers.removeClass(activeClass).next().hide(); triggerMinuses.removeClass(minusClass); $(this).toggleClass(activeClass).next().show(); $(this).next('.target').addClass(activeClass); $(this).children('span').addClass(minusClass); } else { triggers.removeClass(activeClass).next().hide(); 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(){ $("#contactForm").slideToggle("slow"); if (buttonClicked==0) { setButtonOmniture(1); buttonClicked=1; } else { buttonClicked=0; } return false; }); $("#form.tab-government").click(function(){ $("#contactForm").slideToggle("slow"); if (buttonClicked==0) { setButtonOmniture(2); 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; }); } $(document).ready(function() { 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() { $("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 //Show Social tab $("ul#soctabs_tier2_list li").click(function() { var docHeight = $(document).height(); $("#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; }); // 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 { loadSocialFeed('http://www.facebook.com/feeds/page.php?format=atom10&id=40851522417',1); loadSocialFeed('http://twitter.com/statuses/user_timeline/86143723.rss',2); //if (channel == "Home") { loadSocialFeed('http://gdata.youtube.com/feeds/api/users/adt/uploads',3); //} else { // loadSocialFeed('http://gdata.youtube.com/feeds/api/playlists/2E155939A24991E0',3); //} loadSocialFeed('http://www.homesecuritysource.com/rss.aspx',4); } });