var locked=false;var scrollwhat='html, body';var scrollpadding=0;var address;jQuery(document).ready(function($){$(":input").each(function(){if($(this).val()===''){$(this).val($(this).attr("title"));}
$(this).focus(function(){if($(this).val()===$(this).attr("title")){$(this).val('');}});$(this).blur(function(){if($(this).val()===''){$(this).val($(this).attr("title"));}});});if($('#home-top').length){$('#home-top .next, #home-top .prev').hide();var carouselitems=$('#home-top .carousel ul').size();if(carouselitems<0){$('#home-top .next, #home-top .prev').show();$('.carousel').jCarouselLite({visible:1,vertical:true,speed:400,btnNext:".next",btnPrev:".prev"});}}
if($('.category-allied-difference').length){$('.category-allied-difference #promo ul li').hover(function(){$(this).find('p.hover').fadeIn('fast');},function(){$(this).find('p.hover').fadeOut('fast');});}
if($('#real-people').length){var imgsrc='';$('#real-people ul li.left').hover(function(){imgsrc=$(this).find('img').attr('src');$(this).find('p.hover').toggle();$(this).find('h4').css({'color':'#fff'});$(this).find('img').attr('src','/wp-content/themes/outreach/images/bg-real-people-left-new.gif');Cufon.refresh('h4');},function(){$(this).find('p.hover').toggle();$(this).find('h4').css({'color':'#363636'});$(this).find('img').attr('src',imgsrc);Cufon.refresh('h4');});$('#real-people ul li.right').hover(function(){imgsrc=$(this).find('img').attr('src');$(this).find('p.hover').toggle();$(this).find('h4').css({'color':'#fff'});$(this).find('img').attr('src','/wp-content/themes/outreach/images/bg-real-people-right-new.gif');Cufon.refresh('h4');},function(){$(this).find('p.hover').toggle();$(this).find('h4').css({'color':'#363636'});$(this).find('img').attr('src',imgsrc);Cufon.refresh('h4');});}
if($('.category-our-clients').length){$('.category-our-clients tr:first td:odd').css({'background-color':'#f1f2f2'});$('.category-our-clients tr:last td:even').css({'background-color':'#f1f2f2'});}
if($('#news').length){$('#news .category-news').last().addClass('last');}
var showWho;if($('#leadership').length){$('#leadership-controls li').mouseenter(function(){$(this).find('span').show();}).mouseleave(function(){$(this).find('span').hide();});$('#leadership-controls a').click(function(){showWho='.'+$(this).attr('rel');showOverlay(showWho);return false});$('.close-overlay').click(function(){hideOverlay(showWho);});$(document).keyup(function(e){if(e.keyCode==27){$('.close-overlay').click();}});}
function showOverlay(who){$('body').append('<div id="overlay"></div><div id="leader"></div>');$('#leader').html($('#leadership').find(who));$('#leader').find(who).show();$(who+' .close-overlay').show();}
function hideOverlay(who){$('.category-about-leadership').append($(who));$(who+' .close-overlay').hide();$(who).hide();$('#overlay, #leader').remove();}
if($('#customer-promo').length){if($.trim($('.image').text())==""){$('.image').hide();$('#customer-promo p').width(820+'px');$('#customer-promo .carousel ul li').height(175+'px');}
$('.carousel').jCarouselLite({visible:1,btnNext:".next",btnPrev:".prev"});}
if($('#reliable-means').length){$('.reliable-carousel').jCarouselLite({visible:1,start:0,speed:0,circular:false,btnGo:['.controls .one','.controls .two','.controls .three','.controls .four','.controls .five','.controls .six'],beforeStart:function(a){$(a).parent().animate({opacity:0,filter:''},200)},afterEnd:function(a){$(a).parent().animate({opacity:1,filter:''},200)}});$('div#reliable-means .controls li a:first').addClass('current');var startsrc=$('div#reliable-means .controls li a:first').find('img').attr('src').replace('.gif','-active.gif');$('div#reliable-means .controls li a:first').find('img').attr('src',startsrc);$('div#reliable-means .controls a').click(function(){if($(this).is('.current')){return false;}else{var src=$('div#reliable-means .controls a.current').find('img').attr('src').replace('-active','');$('div#reliable-means .controls a.current').find('img').attr('src',src);$('div#reliable-means .controls a.current').removeClass('current');$(this).addClass('current');}}).mouseover(function(){if($(this).is('.current')){return false;}else{var src=$(this).find('img').attr('src').replace('.gif','-active.gif');$(this).find('img').attr('src',src);}}).mouseout(function(){if($(this).is('.current')){return false;}else{var src=$(this).find('img').attr('src').replace('-active','');$(this).find('img').attr('src',src);}});}
$(window).resize(function(){if($(window).width()<1000){$('#search-tab').fadeOut('fast');$('.gototop').hide();}else{$('#search-tab').fadeIn('fast');$('.gototop').show();}});if($('#search-tab, .gototop').length){if($(window).width()<1024){$('#search-tab').fadeOut('fast');$('.gototop').hide();}else{$('#search-tab').fadeIn('fast');$('.gototop').show();}
$('#search-tab').hover(function(){$(this).stop().animate({right:'0px'},{queue:false,duration:500});},function(){$(this).stop().animate({right:'-500px'},{queue:false,duration:500});});}
if($('select').length){$('select').uniform();}
if($('#subnav a').length){$('#subnav li').last().addClass('sub-last');}
$('#subnav a').click(function(event){event.preventDefault();$('.active').removeClass('active');Cufon.refresh('#subnav a');$(this).addClass('active');var target=$(this.hash);if(target.length&&this.hash){var before=$.address.value();$.address.value(target.attr('id'));if(before==$.address.value())scrollToElement(target);}else{$.address.value($(this).attr('href'));}
return false;});$('.gototop a').click(function(event){event.preventDefault();var target=$(this.hash);if(target.length&&this.hash){scrollToElement(target);}
return false;});$.address.change(function(event){if(event.pathNames[0]){$.address.strict(true);scrollToElement($("#"+event.pathNames[0]));}});if($('#subnav').length){var nav=$('#subnav');var the_window=$(window);var topmost_point=nav.offset().top;scrollpadding=nav.height();$('html, body').each(function(){var initScrollTop=$(this).attr('scrollTop');$(this).attr('scrollTop',initScrollTop+1);if($(this).attr('scrollTop')==initScrollTop+1){scrollwhat=this.nodeName.toLowerCase();$(this).attr('scrollTop',initScrollTop);return false;}});the_window.scroll(function(){var y=the_window.scrollTop();if(y>topmost_point){if(!locked){if($('#overlay').length){hideOverlay(showWho);}
$('#scroll-nav').toggle();nav.appendTo('#scroll-nav .wrap');locked=true;}}else{if(locked){$('#scroll-nav').toggle();nav.appendTo('#subnav-container .wrap');locked=false;}}});}
function scrollToElement(el){$(scrollwhat).stop().animate({scrollTop:el.offset().top-scrollpadding},600);}
if($('.category-voice-promo').length){preloader();$('#slider h4.old').click(function(){if($(this).parent('div').hasClass('closed')){$(this).parent('div').css({'background':'url(wp-content/themes/outreach/images/bg-old-phone-system.jpg) 0 0 no-repeat'}).removeClass('closed').addClass('open').animate({left:'0'},500);$('#slider .right').animate({right:'-318px'},500,function(){$('#slider .right').css({'background':'url(wp-content/themes/outreach/images/bg-new-phone-closed.jpg) 0 0 no-repeat'}).removeClass('open').addClass('closed')});}
return false;});$('#slider h4.new').click(function(){if($(this).parent('div').hasClass('closed')){$(this).parent('div').css({'background':'url(wp-content/themes/outreach/images/bg-new-phone-system.jpg) 0 0 no-repeat'}).removeClass('closed').addClass('open').animate({right:'0'},500);$('#slider .left').animate({left:'-318px'},500,function(){$('#slider .left').css({'background':'url(wp-content/themes/outreach/images/bg-old-phone-closed.jpg) 100% 0 no-repeat'}).removeClass('open').addClass('closed')});}
return false;});}
$('#contact-form').submit(function(){$('.error').hide();var hasError=false;var emailVal=$('#email').val();var emailReg=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;if($('#name').val()=='Name'||$('#name').val()==''){$('#name').after('<span class="error">Please enter your name.</span>');hasError=true;}
if(emailVal==''||emailVal=='Email'){$('#email').after('<span class="error">Please enter a valid email address.</span>');hasError=true;}
else if(!emailReg.test(emailVal)){$('#email').after('<span class="error">Please enter a valid email address.</span>');hasError=true;}
if($('#subject').val()==''){$('#uniform-subject').after('<span class="error">Please select a department.</span>');hasError=true;}
if(hasError==true){return false;}});$('#request-quote').submit(function(){$('.error').hide();var hasError=false;var emailVal=$('#email').val();var emailReg=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;if($('#first_name').val()=='First name'||$('#name').val()==''){$('#first_name').after('<span class="error">Please enter your name.</span>');hasError=true;}
if(emailVal==''||emailVal=='Email'){$('#email').after('<span class="error">Please enter a valid email address.</span>');hasError=true;}
else if(!emailReg.test(emailVal)){$('#email').after('<span class="error">Please enter a valid email address.</span>');hasError=true;}
if($('#lead_source').val()==''){$('#uniform-lead_source').after('<span class="error">Please select a lead source.</span>');hasError=true;}
if($('#00N50000001K9Dv').val()==''){$('#uniform-00N50000001K9Dv').after('<span class="error">Please select a product interest.</span>');hasError=true;}
if(hasError==true){return false;}});});function preloader()
{var i=0;imageObj=new Image();images=new Array();images[0]="wp-content/themes/outreach/images/bg-old-phone-system.jpg"
images[1]="wp-content/themes/outreach/images/bg-new-phone-closed.jpg"
for(i=0;i<=17;i++)
{imageObj.src=images[i];}}
