	//add JSON library so that IE6 and 7 will smarten up
var jsonLibrary = document.getElementsByTagName("head")[0];         
var jsonLibraryNode = document.createElement('script');  
jsonLibraryNode.src = '/cg-pc/Halifax/SiteCollectionImages/json2.js';  
jsonLibrary.appendChild(jsonLibraryNode);
	//check if logged in or not
if(window.location.hostname=="www.cgadmin.cfpsa.ca"){
var loggedIn = true;
var loggedOut = false;
$(function(){
_gaq.push(['_setCustomVar', 1, "Visitor_Type", "Employee", 3]);
});
}
if(window.location.hostname=="www.cg.cfpsa.ca"){
var loggedIn = false;
var loggedOut = true;
}

	//Track Francais hits
	$(function(){
lang = window.location.pathname;
lang = lang.split('/');
lang = lang[3];
_gaq.push(['_setCustomVar', 2, 'Language', lang, 3]);
});

	//fix IE's inability to search multi-dimensional arrays
if(!Array.indexOf){
  Array.prototype.indexOf = function(obj){
   for(var i=0; i<this.length; i++){
    if(this[i]==obj){
     return i;
    }
   }
   return -1;
  }
}
	//date variables to use in various functions
var fillInDate = new Date();
var year = fillInDate.getFullYear();
var yearShort = String(year).substr(2);
var month = fillInDate.getMonth()+1;
var day = fillInDate.getDate();
(String(month).length < 2) ? month = String("0" + month) :  month = String(month);
(String(day).length < 2) ? day = String("0" + day) :  day = String(day);
var date = year+'/'+month+'/'+day;
	//iphone and ipod stuff
var iPhone=navigator.userAgent.toLowerCase().indexOf('iphone')!=-1;  
var iPod=navigator.userAgent.toLowerCase().indexOf('ipod')!=-1;  
if((iPhone||iPod)&&document.getElementById('imageNav')){
	$('#imageNav a:nth-child(2)').text('MAP');
	$('#imageNav a:nth-child(3)').text('HOME');
	$('#imageNav a:nth-child(4)').text('ABOUT');
}
$('head').append('<meta name="viewport" content="width=750" />');
	//hide premature titles
$(function(){ $('.copyTitle').parents('div.ms-WPBody').hide(); });
	//hide Registration dropdown
$('img[alt="Expand Registration"]').remove();
$('a:contains("Online Registration")').parents('#navigationLeft div').remove();
var dAllow = new Array('pdf','xls','xlsx','doc','docx','ppt','pptx');
	//Create documents out of image tags
$('img').each(function(){
   file = $(this).attr('src');
   dExt = file.split('.').pop().toLowerCase();
        if($.inArray(dExt, dAllow) != -1) {
            var name = file.split('/').pop();
            if(dExt=='pdf'){
               var icon = 'pdf'; 
            }
            if(dExt=='doc' || dExt=='docx'){
               var icon = 'doc'; 
            }
            if(dExt=='xls' || dExt=='xlsx'){
               var icon = 'xls'; 
            }
            if(dExt=='ppt' || dExt=='pptx'){
               var icon = 'ppt'; 
            }
             $(this).before('<img src=http://www.cg.cfpsa.ca/_layouts/images/'+icon+'16.gif /> ');  
             $(this).replaceWith('<a href='+file+' target=_blank>'+name+'</a>');
        }
});
	//Create video out of image tags
var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var vAllow = new Array('wmv','flv','mpg','mpeg','avi','mov','rm');
$('img').each(function(){
   movie = $(this).attr('src');
   vExt = movie.split('.').pop().toLowerCase();
        if($.inArray(vExt, vAllow) != -1 || isMedia('youtube') || isMedia('dailymotion')) {
            if(vExt=='flv'){
                $(this).before('<object class="playerpreview" type="application/x-shockwave-flash" data="http://flv-player.net/medias/player_flv_maxi.swf" width="500" height="400"><param name="movie" value="http://flv-player.net/medias/player_flv_maxi.swf"><param name="allowFullScreen" value="true"><param name=wmode value=opaque><param name="FlashVars" value="flv='+movie+'&amp;width=500&amp;height=400&amp;showstop=1&amp;showvolume=1&amp;showtime=1&amp;startimage=http://www.cg.cfpsa.ca/cg-pc/Halifax/SiteCollectionImages/flvplayer2.jpg&amp;showfullscreen=1&amp;bgcolor1=151515&amp;bgcolor2=630405&amp;playercolor=630405"><p>Vidéo de démonstration.</p></object><br>');
            }
            if(isMedia('youtube')){
                var yt = movie.split('&').shift().split('=').pop();
             $(this).before('<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/'+yt+'?fs=1&amp;hl=en_US&amp;rel=0"></param><param name=wmode value=opaque><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+yt+'?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br>');
            }
            if((vExt=='wmv' && !isChrome) || vExt=='mpg' || vExt=='mpeg' || vExt=='avi'){
                $(this).before('<OBJECT ID="MediaPlayer" WIDTH="480" HEIGHT="385" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> <PARAM NAME="FileName" VALUE="'+movie+'"> <PARAM name="autostart" VALUE="false"> <PARAM name="ShowControls" VALUE="true"> <param name="ShowStatusBar" value="false"> <param name=wmode value=opaque> <PARAM name="ShowDisplay" VALUE="false"> <EMBED TYPE="application/x-mplayer2" SRC="'+movie+'" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" NAME="MediaPlayer" WIDTH="480" HEIGHT="385" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED></OBJECT><br>');
            }
            if(vExt=='mov'){
                $(this).before('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="360" width="480"> <param name="src" value="'+movie+'"> <param name="autoplay" value="false"> <param name="type" value="video/quicktime" height="360" width="480"> <embed src="'+movie+'" height="360" width="480" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></object><br>');
            }
            if(isMedia('dailymotion')){
                var dm = movie.split('/').pop().split('_').shift();
                $(this).before('<object width="480" height="360"><param name="movie" value="http://www.dailymotion.com/swf/video/'+dm+'?width=&theme=none&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B&start=&animatedTitle=&iframe=0&additionalInfos=0&autoPlay=0&hideInfos=0"></param> <param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/'+dm+'?width=&theme=none&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B&start=&animatedTitle=&iframe=0&additionalInfos=0&autoPlay=0&hideInfos=0" width="480" height="360" allowfullscreen="true" allowscriptaccess="always"></embed></object><br>');
            }
            if(vExt=='rm'){
             $(this).before('<OBJECT id=rvocx classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width="320" height="240"><param name=src value="http://servername/path/to/media.file"><param name=autostart value="false"><param name=controls value=imagewindow><param name=console value=video><param name=loop value="false"><EMBED src='+movie+' width="320" height="240" loop="false" type=audio/x-pn-realaudio-plugin controls=imagewindow console=video autostart="false"></EMBED></OBJECT><OBJECT id=rvocx classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width=320 height=30><param name=src value='+movie+'><param name=autostart value=false> <param name=controls value=ControlPanel><param name=console value=video><EMBED src='+movie+' width=320 height=30 controls=ControlPanel type=audio/x-pn-realaudio-plugin console=video autostart="false"></EMBED></OBJECT><br>');   
            }
        }
});
function isMedia(x){
var y = new RegExp(x,'i');
if(movie.search(y) != -1){
    return true;
    }
}	
	//add jQuery UI library for scrolling newsbox&sponsorlogos
var jUI = document.getElementsByTagName("head")[0];         
var jUINode = document.createElement('script');  
jUINode.src = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js';  
jUI.appendChild(jUINode);

	//determine page
var thisPage = $('span.ms-sitemapdirectional').text();
function isPage(x) {
var y = new RegExp(x,'i');
if(thisPage.search(y) != -1){
return true;
}
else{
return false;
}
}
	//determine column
function columnCheck(x) {
    if ($(x).is('#removePadding ' + x)) {
        return rightNav=1;
    }
    if ($(x).is('#center ' + x)) {
        return centerSection=1;
    }
}	
	//function to remove right navigation
function removeRight(){
$('.removePadding').remove();
}

$(function(){
var originalPage = document.title;
if(window.location.pathname=="/cg-pc/Halifax/EN/Pages/default.aspx"){
	//if page is the main page, end function
document.title = "CFB Halifax Community Gateway";
}
else if(originalPage.search("Home") != -1) {
	//if page has no title, create one
document.title = thisPage;
$('#ctl00_PlaceHolderMain_ctl01__ControlWrapper_RichHtmlField').prepend("<b>"+thisPage+"</b>");
}
else{
$('#ctl00_PlaceHolderMain_ctl01__ControlWrapper_RichHtmlField').prepend("<b>"+originalPage+"</b>");
}
});
	//include employee pages
if(isPage("Sponsor")){
$('#navigationLeft').append('<a href=/cg-pc/Halifax/EN/SponsorshipandDonations/specialevents/Pages/Employees.aspx style="padding:7px;color:white;position:relative;top:7px">Employees</a>');
}
if(isPage("Health Promotions")){
$('#navigationLeft').append('<a href=/cg-pc/Halifax/EN/HealthPrograms/HealthPromotion/Pages/Employees.aspx style="padding:7px;color:white;position:relative;top:7px">Employees</a>');
}

$(function(){
	//Odd table columns, first lines, and row highlights
$('head').append("<style id=firstLine>/*First line of pages */ #center tr:nth-child(2) .ms-WPBody:first-line {font-variant:small-caps;font-size:10pt} </style>");
/* French content apology
$('#center td[width=500]').append("<div id=noFrench><br>--<br><br><font size=1><em>Due to the urgency of the preceding content, it has been posted in English only. We regret that a French translation is not yet available. The translated version will be posted as soon as possible.<br><br>&Agrave; cause de l'urgence du contenu pr&eacute;c&eacute;dent, on l'a publi&eacute; seulement en anglais. Nous regrettons que la traduction fran&ccedil;aise est incompl&egrave;te &agrave; ce moment. Elle sera affich&eacute;e aussit&ocirc;t que possible.</em></font></div>").css('padding-right', '20px');
*/
});
$(function(){
	//track national link clicks
$('a.link-item.bullet').click(function(){
_gaq.push(['_trackEvent', 'National Link', $(this).text()]);
});
	//track sponsor links
$('#sponsorTable .last td a').click(function(){
	var i = $('#sponsorTable .last td a').index(this);
_gaq.push(['_trackEvent', 'Wanted Sponsor Info', $('#sponsorTable .first th:eq('+i+')').text()]);
});	
	//track the triple click
clickCounter = 0;
$('a').click(function(){
	if($(this).attr('href')!="#"){
        clickCounter++;
    if(clickCounter==1){
       clickOne = new Date();
    }
	if(clickCounter==3){
		clickTwo = new Date();        
		var timeWaiting = (clickTwo.getTime()-clickOne.getTime())/1000;
		_gaq.push(['_trackEvent', 'Long Load Time', timeWaiting]);
	}
		}
	});
});

$(function(){
	//multipage drop downs
	var link = $('.pages a[href$=#]');
link.click(function (event) {
var pageTrigger = link.index(this);
var dropDown = $('.pages div:eq('+pageTrigger+')');
link.css('color','#039').css('text-decoration','none');
$('.pages div:visible').slideUp(250);
if(dropDown.is(":not(':visible')")){
$('html, body').delay(100).animate({ scrollTop: $(this).offset().top - $('.pages div:visible').outerHeight() - 12 }, 300);
$(this).css('color','#800').css('text-decoration','underline');
dropDown.slideDown(100);
}
event.preventDefault();
});
});

$(function(){
	//conditional codes for IE
$('head').append("<script>$(function(){ $('.ms-sbplain').width('130px').css('margin-top','1px'); }); $(function(){ $('.removePadding table').eq(0).css({'margin-bottom': '-45px','position': 'relative','top':'-32px','background-color':'#EDF0F0','padding': '5px', WebkitBorderRadius: '0px 0px 15px 15px', MozBorderRadius: '0px 0px 15px 15px', BorderRadius: '0px 0px 15px 15px'}) }); </script> <style> /*Fix search bar*/ #headerSearch .ms-sbtable.ms-sbtable-ex{position:relative;left:29px;top:-1px} td.ms-sbcell {border-color:#292929} </style> <!--[if IE 8]> <style> div.ms-pagebreadcrumb.removeMargins{width:542px}</style><![endif]-->");
$('head').append("<!--[if IE 6]> <script>  </script><style> div.ms-pagebreadcrumb.removeMargins{width:544px} #newsBox{position:absolute}</style><![endif]-->");
$('head').append("<!--[if IE]><script>$('#globalContainer > a + div').css('position','relative').css('margin-top','-2px'); $(function(){ $('.ms-sbplain').width('123px').height('11px'); }); $(function(){ $('.removePadding table').eq(0).css('top','-35px'); $('.removePadding').css('margin-top','-35px'); }); </script><style>#headerSearch .ms-sbtable.ms-sbtable-ex{top:-2px}</style><![endif]-->");
});
	
function startSporadicSponsorBox(){
								//variables for the sponsor animations
							enterSponsor = 500;
							showSponsor = 4000;
							exitSponsor = 300;
							sponsorNum3 = $('#sponsorBox3 img').length;
							sponsorNum2 = $('#sponsorBox2 img').length;
							sponsorNum1 = $('#sponsorBox1 img').length;
							time_eachSponsor = (enterSponsor+showSponsor+exitSponsor);
							startsponsorBox1();
							var t1 = setInterval("startsponsorBox1()",(time_eachSponsor)*sponsorNum1);
							startsponsorBox2();
							var t2 = setInterval("startsponsorBox2()",(time_eachSponsor)*sponsorNum2);
							startsponsorBox3();
							var t3 = setInterval("startsponsorBox3()",(time_eachSponsor)*sponsorNum3);
							$('#sporadicSponsorBox a').click(function(){
							_gaq.push(['_trackEvent', 'Clicked Sponsor Link', $(this).attr('href'), 'Animated Sponsor Image']);
							});
							}
								//FOR loops to cycle through the logo animations
							function startsponsorBox1(){
							for(x=0;x<=sponsorNum1-1;x++){
							sponsorBox1(x);
							}
							}  
							function sponsorBox1(x){
							var buffer = time_eachSponsor*x;
							$('#sponsorBox1 img').eq(x).delay(buffer).fadeIn(enterSponsor).delay(showSponsor).fadeOut(exitSponsor);
							}
							function startsponsorBox2(){
							for(n=0;n<=sponsorNum2-1;n++){
							sponsorBox2(n);
							}
							}  
							function sponsorBox2(n){
							var buffer = time_eachSponsor*n;
							$('#sponsorBox2 img').eq(n).delay(buffer).fadeIn(enterSponsor).delay(showSponsor).fadeOut(exitSponsor);
							}
							function startsponsorBox3(){
							for(n=0;n<=sponsorNum3-1;n++){
							sponsorBox3(n);
							}
							}
							function sponsorBox3(n){
							var buffer = time_eachSponsor*n;
							$('#sponsorBox3 img').eq(n).delay(buffer).fadeIn(enterSponsor).delay(showSponsor).fadeOut(exitSponsor);
							}
							
$(function(){
if(loggedIn){
	//logged in
	//create logout link
$('#center').prepend('<a class=loginOut></a>');
$('.loginOut').attr('href','https://www.cgadmin.cfpsa.ca/cg-pc/Halifax/EN/_layouts/SignOut.aspx').text('Logout (requires closing browser)').after('<a class=signOut href=http://www.cg.cfpsa.ca' + window.location.pathname + '>Preview Page (Log out temporarily)</a>');
$('.chooseMe').removeClass();
$('body').append('<a style="position:absolute;background:white;color:black;top:0px;padding:10px;" href=https://www.cgadmin.cfpsa.ca/cg-pc/Halifax/EN/Facilities/fleetgym/FacilityTour/ez/Pages/default.aspx>Go to the Employee Zone</a> <a style="position:absolute;background:white;color:black;top:40px;padding:10px;" href=/cg-pc/Halifax/SiteCollectionImages/CommunityGatewayEditorsGuide.pdf>View the Webpage User Guide</a>');
}else{
	//logged out
	//create login link
$('#center').prepend('<a class=loginOut onclick="return false"></a>');
$('.loginOut').attr('href','#').text('Login');
	//track employee usernames
$('a.loginOut').live('click',function(){
    $(this).replaceWith('<span class=loginOut>Type Username, then press ENTER: <input /></span>');
    $('.loginOut input').focus();
});
$('.loginOut input').live('keydown',function(e){
    if(e.which=="13"){
	_gaq.push(['_trackEvent', 'Employee Login', $(this).val()]);
	var t = setTimeout(location.replace('https://www.cgadmin.cfpsa.ca' + window.location.pathname), 100);
    }
});
	//stupid IE stuff
$('#publishingcontrols').remove();
	//make H3 tags stand out
$('head').append('<![if !IE]><style> #centerContent {table-layout:fixed} /*Fix rightNav*/ #navigationLeft{width:190px} #center{width:100%} .removePadding{position:relative;right:-2px;top:-22px;float:right}</style><![endif]> <style>/*sponsorlogos*/ .chooseMe {height:60px;width:120px;overflow:hidden} /*incredible h3*/ h3{padding:5px;-webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; text-align:center; font-size:9pt; color:black } </style>');
$('h3').css('background-color','#E0F0FF');
$('h3:odd').css('background-color','#FFFFE0');
$('h3').filter(function(index){
return index % 3 == 2;
}).css('background-color', '#E0FFF0');
$('h3').filter(function(index){
return index % 4 == 3;
}).css('background-color', '#FFE0F0');
	//create sporadic animated sponsor box
if(document.getElementById('loadSponsorBox')){
	//find #loadSponsorBox and load the sponsorbox
$('#loadSponsorBox').load('/cg-pc/Halifax/EN/SponsorshipandDonations/specialevents/Pages/Employees.aspx table.chooseMe', function(){
	$('table.chooseMe').hide();
    $('table.chooseMe td:first-child img').each(function(){
    var url = $(this).parent().next('td').text();
    var src = $(this).attr('src');
    $(this).replaceWith('<a href='+url+' target=_blank><img src='+src+' /></a>');
});
    $('table.chooseMe tr:gt(0) td:nth-child(3)').each(function(){
    var url = $(this).prev('td').text();
    var text = $(this).text();
        if($.trim(text).length<1){
         $(this).parent('tr').remove();   
        }
        else{
    $(this).html('<a href='+url+' target=_blank>'+text+'</a>');    
        }
});
	//move images from employees table to the sponsorbox
    $('table.chooseMe td:first-child a').clone().appendTo('#sporadicSponsorBox');
	//save employees table information to an array for later use
var sponsorNumber = $('table.chooseMe tr').length - 1;
var sponsorArray = new Array();
for(i=0;i<5;i++){
 sponsorArray[i] = new Array(sponsorNumber);   
}
$('table.chooseMe tr:gt(0) td:nth-child(1)').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(1)').index(this);
    sponsorArray[0][x] = $(this).html();
});
$('table.chooseMe tr:gt(0) td:nth-child(2)').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(2)').index(this);
    sponsorArray[1][x] = $(this).html();
});
$('table.chooseMe tr:gt(0) td:nth-child(3)').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(3)').index(this);
    sponsorArray[2][x] = $(this).html();
    sponsorArray[3][x] = $(this).html();
});
$('table.chooseMe tr:gt(0) td:nth-child(1) a').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(1) a').index(this);
    sponsorArray[4][x] = $(this).html();
});
	//randomize images in sponsorbox
var max = $('#sporadicSponsorBox a').length;
var s = $.makeArray(document.getElementById('sporadicSponsorBox').getElementsByTagName('a'));
s.sort(function() { return Math.round((Math.random()*(max+1.99))-1.5); });
$('#sporadicSponsorBox').append(s);
	//split images into three boxes
var split = Math.round(max/3);
for(i=1;i<=3;i++){
    $('#sporadicSponsorBox').append('<div id=sponsorBox'+i+'></div>');
$('#sporadicSponsorBox a:lt('+split+')').appendTo('#sponsorBox'+i);
}
	//make it horizontal if it's in the center
if(columnCheck('#sporadicSponsorBox')==centerSection){
$('#sponsorBox1,#sponsorBox2,#sponsorBox3').css('float','left')
}
	//remove the employees table from the current page
$('table.chooseMe').remove();
	//show the sponsorbox when the loading is complete
$('#sporadicSponsorBox').show(500);
	//start animation script
startSporadicSponsorBox();
}); 
}
	//if the loadSponsorList element exists, then load the employee table information
if(document.getElementById('loadSponsorList')){
$('#loadSponsorList').load('/cg-pc/Halifax/EN/SponsorshipandDonations/specialevents/Pages/Employees.aspx table.chooseMe', function(){
	$('table.chooseMe').hide();
    $('table.chooseMe td:first-child img').each(function(){
    var url = $(this).parent().next('td').text();
    var src = $(this).attr('src');
    $(this).replaceWith('<a href='+url+' target=_blank><img src='+src+' /></a>');
});
    
    $('table.chooseMe tr:gt(0) td:nth-child(3)').each(function(){
    var url = $(this).prev('td').text();
    var text = $(this).text();
        if($.trim(text).length<1){
         $(this).parent('tr').remove();   
        }
        else{
    $(this).html('<a href='+url+' target=_blank>'+text+'</a>');    
        }
});
	//save the employee table information to an array for later use
var sponsorNumber = $('table.chooseMe tr').length - 1;
var sponsorArray = new Array();
for(i=0;i<=4;i++){
 sponsorArray[i] = new Array(sponsorNumber);   
}
$('table.chooseMe tr:gt(0) td:nth-child(1)').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(1)').index(this);
    //linked image
    sponsorArray[0][x] = $(this).html();
});
$('table.chooseMe tr:gt(0) td:nth-child(3)').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(3)').index(this);
    //link
    sponsorArray[1][x] = $(this).html();
    //unsorted name reference
    sponsorArray[2][x] = $(this).text();
    //will-be-sorted name
    sponsorArray[3][x] = $(this).text();
});
$('table.chooseMe tr:gt(0) td:nth-child(1) a').each(function(){
    var x = $('table.chooseMe tr:gt(0) td:nth-child(1) a').index(this);
    //just the image
    sponsorArray[4][x] = $(this).html();
});
	//sort the sponsors alphabetically
sponsorArray[3].sort();
for(i=0;i<sponsorArray[3].length;i++){
    $('#sponsorList').append('<p>'+sponsorArray[3][i]+'</p>');
}
	//create links to the sponsors pages, respectively
$('#sponsorList p').each(function(){
      var text = $(this).text();
      var unsorted = sponsorArray[2].indexOf(text);
    $(this).replaceWith(sponsorArray[1][unsorted]+'<br/>');
});
	//show the sponsor's logo when the mouse goes over the sponsor link (not in IE7)
$('#sponsorList a').hover(function(){
    var i = $('#sponsorList a').index(this);                              
    var parentHtml = $(this).parent().html();  
    var doThis = parentHtml.split('<BR>').join('<br>').split('<br>');
    var theAnswer = doThis[i];
    var response = sponsorArray[1].indexOf(theAnswer);
$(this).after(sponsorArray[4][response]);
}, function(){
$(this).parent().find('img').remove();    
});
	//track clicks to sponsor links
$('#sponsorList a').click(function(){
							_gaq.push(['_trackEvent', 'Clicked Sponsor Link', $(this).attr('href'), 'Sponsor List']);
							});
	//remove the employee table from the current page
$('table.chooseMe').remove();
});}
	//write login link
$('.loginOut').attr('href', 'https://www.cgadmin.cfpsa.ca' + window.location.pathname).text('Login');
}
});

$(function(){
	//make variable h3 background widths based on character count
$('h3').each(function(){
if(!($(this).width())){
$(this).width($(this).html().length*6+30+'px');
}
$(this).css('font-size','9pt');
});
	//remove hover over titles
$('#navigationLeft tr').removeAttr('title');
	//set "undefined" glitches to read "Halifax"
$('.ms-pagebreadcrumb.removeMargins a.ms-sitemapdirectional').eq(0).text("Halifax");
});
