// Get query string 
var querystring = location.search.replace( "?", "" ).split( "&" );
var queryObj = {};

for ( var i = 0; i < querystring.length; i++ ) {
  var name = querystring[i].split( "=" )[0];
  var value = querystring[i].split( "=" )[1];
  queryObj[name] = value;
}

/* consolidated.custom.js */

var crossFadeTabs = function( selector ) {
    var list        = $( selector );

    var heights     = {};
    var labels      = $$( "#"+selector+" dt" );
    var panes       = $$( "#"+selector+" dd" );
    var tabHeight 	= labels[0].getCoordinates().height;
	var maxHeight	= 0;
    
    var fx          = new Fx.Elements( panes, { duration: 500 } );

    panes.each( function( pane, i ) {
        pane.addClass( 'pane' );
        var o = {};

        heights[i] = pane.getCoordinates().height;
		if (heights[i] > maxHeight)
			maxHeight = heights[i];
        if( i != 0 ) {
            o[i] = { opacity : 0 };
            fx.set( o );
            pane.setStyle( 'visibility', 'hidden' );
        } else {
            list.setStyle( 'height', heights[i] + tabHeight );
            pane.setStyle( 'height', heights[i] );
        }
    });

    labels.each( function( label, labelIndex ) {
        label.addClass( 'label' );  
    	label.addEvent( "mouseover", function( event ) {
			label.addClass( 'hover' );
		});
		label.addEvent( "mouseout", function( event ) {
			label.removeClass( 'hover' );
		});
        label.addEvent( "click", function( event ) {
            label.addClass( 'selected' );
            var o = {};
            labels.each( function( oldLabel, oldLabelIndex ) {
                
                if( labelIndex != oldLabelIndex && oldLabel.hasClass( 'selected' ) ) {
                    
                    oldLabel.removeClass( 'selected' );
                    o[ oldLabelIndex ] = { opacity : 0 };
                    o[ labelIndex ] = { opacity : 1 };   
               		fx.start( o );              
                    
                }
            });
        });
       
 		if (label.id == queryObj.tab) {
			label.fireEvent('click');
		} else if( labelIndex == 0 ) { 
            label.addClass( 'selected' ); 
        }
    });

	list.setStyle( 'height', maxHeight );

};

var crossFadeHoverTabs = function( selector ) {
    var list        = $( selector );

    var heights     = {};
    var labels      = $$( "#"+selector+" dt" );
    var panes       = $$( "#"+selector+" dd" );
    var tabHeight 	= labels[0].getCoordinates().height;
	var maxHeight	= 0;
	var openTarget 	= 0;
    
    var fx          = new Fx.Elements( panes, { duration: 100 } );

	switch (queryObj.rcTab) {
		case 'rewardchecking':
			openTarget = 1;
			break;
		case 'realsaver':
			openTarget = 2;
			break;
		case 'realgiving':
			openTarget = 3;
			break;
		case 'realcashback':
			openTarget = 4;
	}

    panes.each( function( pane, i ) {
        pane.addClass( 'pane' );

        heights[i] = pane.getCoordinates().height;
		if (heights[i] > maxHeight)
			maxHeight = heights[i];
        if( i != openTarget ) {
            pane.setStyle( 'visibility', 'hidden' );
        }
    });

    labels.each( function( label, labelIndex ) {
        label.addClass( 'label' );  
    	label.addEvent( "mouseover", function( event ) {
            label.addClass( 'selected' );
            labels.each( function( oldLabel, oldLabelIndex ) {
                
                if( labelIndex != oldLabelIndex && oldLabel.hasClass( 'selected' ) ) {
                    
                    oldLabel.removeClass( 'selected' );
                    panes[ oldLabelIndex ].setStyle( 'visibility', 'hidden' );        
                    
                }
            });
			panes[labelIndex].setStyle( 'visibility', 'visible');
        });
        if( labelIndex == openTarget ) { 
            label.addClass( 'selected' ); 
        }
    });

	list.setStyle( 'height', 388);
	list.setStyle( 'background', 'transparent url(/custom/bancvue/image/accountTypes-bg.png) top center no-repeat');

};

var crossFadeHomeTabs = function( selector ) {
	
    var list        = $j( "#"+selector );
    var labels      = $j( "#"+selector+" dt a" );
    var panes       = $j( "#"+selector+" dd" );
	var counter 	= 0;   
	var homeTabsTimer;

	function selectTab ( selectTarget ) {
		if ($('homeTickerFlash'))
			$('homeTickerFlash').sendToActionScript(selectTarget);
		labels.each( function( labelIndex, label ) {
			if (labelIndex == selectTarget) {
				$j(this).addClass('selected');
			} else {
				$j(this).removeClass('selected');
			}
		});
		panes.each( function( labelIndex, label ) {
			if (labelIndex == selectTarget) {
				$j(this).fadeIn(800);
			} else {
				$j(this).fadeOut(800);
			}
		});
	}

    panes.each( function( i, pane ) {
        if( i != 0 ) {
            $j(this).hide();
        }
    });

    labels.each( function( labelIndex, label ) {
    	$j(this).hoverIntent(function() {
			counter = labelIndex;
            selectTab( labelIndex );
			clearTimeout( homeTabsTimer );
        }, function() {
			return true;
		});
        if( labelIndex == 0 ) { 
            $j(this).addClass( 'selected' ); 
        }
    });

	// Auto-rotate function
	var autoRotate = function() {
		counter++;
		var rotateTarget = (counter % labels.length);
		selectTab( rotateTarget )
		homeTabsTimer = setTimeout( autoRotate, 5000 );
	}

	// Set Timers
	var homeTabsTimer = setTimeout( autoRotate, 5000 );

};


var dotGallery = function( selector ) {

    var target      = $( selector );
    var panes       = $$( "#"+selector+" ul li" );
    var fx          = new Fx.Elements( panes, { duration: 500 } );
	var counter 	= 0;
	var navigation	= document.createElement('ol');
	
	$(navigation).addClass('dotGalleryNavigation');

	// Create Navigation List
	
    panes.each( function( pane, i ) {
        pane.addClass( 'pane' );
		var paneLabel = document.createElement('li');
		var labelText = document.createTextNode(i);
		paneLabel.appendChild(labelText);
		navigation.appendChild(paneLabel);
        var o = {};
        if( i != 0 ) {
            o[i] = { opacity : 0 };
            fx.set( o );
            pane.setStyle( 'visibility', 'hidden' );
        }
    });

	target.appendChild(navigation);
	$(navigation).setStyle('width', (panes.length * 15)+'px');

    var labels      = $$( "#"+selector+" ol.dotGalleryNavigation li" );

    labels.each( function( label, labelIndex ) {
        label.addClass( 'label' );  
    	label.addEvent( "mouseover", function( event ) {
			label.addClass( 'hover' );
		});
		label.addEvent( "mouseout", function( event ) {
			label.removeClass( 'hover' );
		});
        label.addEvent( "click", function( event ) {
            label.addClass( 'selected' );
            var o = {};
			counter = labelIndex;
            labels.each( function( oldLabel, oldLabelIndex ) {
                
                if( labelIndex != oldLabelIndex && oldLabel.hasClass( 'selected' ) ) {
                    
                    oldLabel.removeClass( 'selected' );
                    o[ oldLabelIndex ] = { opacity : 0 };
                    o[ labelIndex ] = { opacity : 1 };   
               		fx.start( o );              
                    
                }
			if (autoTimer)
				clearTimeout(autoTimer);
            });
        });
        if( labelIndex == 0 ) { 
            label.addClass( 'selected' ); 
        }
    });

	// Auto-rotate function
	var autoRotate = function() {
		counter++;
		labels[(counter % labels.length)].fireEvent('click');
		autoTimer = setTimeout( autoRotate, 5000 );
	}

	// Set Timers
	if (target.hasClass('autorotate'))
		var autoTimer = setTimeout( autoRotate, 5000 );

};

var dotGalleryPress = function( selector ) {
	
	var heights		= {};
    var target      = $( selector );
    var panes       = $$( "#"+selector+" li.galleryItem" );
    var fx          = new Fx.Elements( panes, { duration: 500 } );
	var counter 	= 0;
	var navigation	= document.createElement('ol');
	var maxHeight	= 0;
	
	$j(navigation).addClass('dotGalleryNavigation');

	// Create Navigation List
	
    panes.each( function( pane, i ) {
        pane.addClass( 'pane' );
		var paneLabel = document.createElement('li');
		var labelText = document.createTextNode(i);
		paneLabel.appendChild(labelText);
		navigation.appendChild(paneLabel);
        var o = {};

        heights[i] = pane.getCoordinates().height;
		if (heights[i] > maxHeight)
			maxHeight = heights[i];

        if( i != 0 ) {
            o[i] = { opacity : 0 };
            fx.set( o );
            pane.setStyle( 'visibility', 'hidden' );
        } else {
            target.setStyle( 'height', heights[i] );
            pane.setStyle( 'height', heights[i] );
        }

    });

	target.appendChild(navigation);
	$(navigation).setStyle('width', (panes.length * 15)+'px');

    var labels      = $$( "#"+selector+" ol.dotGalleryNavigation li" );

    labels.each( function( label, labelIndex ) {
        label.addClass( 'label' );  
    	label.addEvent( "mouseover", function( event ) {
			label.addClass( 'hover' );
		});
		label.addEvent( "mouseout", function( event ) {
			label.removeClass( 'hover' );
		});
        label.addEvent( "click", function( event ) {
            label.addClass( 'selected' );
            var o = {};
			counter = labelIndex;
            labels.each( function( oldLabel, oldLabelIndex ) {
                
                if( labelIndex != oldLabelIndex && oldLabel.hasClass( 'selected' ) ) {
                    
                    oldLabel.removeClass( 'selected' );
                    o[ oldLabelIndex ] = { opacity : 0 };
                    o[ labelIndex ] = { opacity : 1 };   
               		fx.start( o );              
                    
                }
            });
        });
        if( labelIndex == 0 ) { 
            label.addClass( 'selected' ); 
        }
    });

	target.setStyle( 'height', maxHeight );

};

// Our Team

var teamBuilder = function( target ) {

	target.find('#innerContainer').css({
		'overflow': 'hidden',
		'width': 765,
		'height': 389,
		'position': 'relative'
	});

	target.find('ul').css({
		'width': 1057,
		'height': 389,
		'left': -145,
		'top': 0,
		'position': 'absolute'
	});

	target.append('<div id="prev"><a href="#">Previous</a></div><div id="next"><a href="#">Next</a></div>');

	$j(target).find('#prev a').click(function() {
		$j('#teamContainer ul').animate({
			'left': 0
		}, 400, 'easeInOutCirc');
		return false;
	});

	$j(target).find('#next a').click(function() {
		$j('#teamContainer ul').animate({
			'left': -288
		}, 400, 'easeInOutCirc');
		return false;
	});

	var teamMembers = $j('#teamContainer li');
	teamMembers.find('.bioContainer').css({
		'top': 309
	});
	teamMembers.hoverIntent(function() {
		$j(this).find('.bioContainer').stop(true, true).animate({
			'top': 0
		}, 200, 'easeInOutCirc');
	}, function() {
		$j(this).find('.bioContainer').stop(true, true).animate({
			'top': 309
		}, 200, 'easeInOutCirc');
	});

};

/** create month sting for month label **/

function monthToString(month) {
	var returnString = '';
	switch (month) {
		case 0:
			returnString = 'January';
			break;
		case 1:
			returnString = 'February';
			break;
		case 2:
			returnString = 'March';
			break;
		case 3:
			returnString = 'April';
			break;
		case 4:
			returnString = 'May';
			break;
		case 5:
			returnString = 'June';
			break;
		case 6:
			returnString = 'July';
			break;
		case 7:
			returnString = 'August';
			break;
		case 8:
			returnString = 'September';
			break;
		case 9:
			returnString = 'October';
			break;
		case 10:
			returnString = 'November';
			break;
		case 11:
			returnString = 'December';
			break;			
	}
	return returnString;
}

/** create month string for date label **/

function monthToStr(month) {
	var returnString = '';
	switch (month) {
		case 0:
			returnString = 'JAN';
			break;
		case 1:
			returnString = 'FEB';
			break;
		case 2:
			returnString = 'MAR';
			break;
		case 3:
			returnString = 'APR';
			break;
		case 4:
			returnString = 'MAY';
			break;
		case 5:
			returnString = 'JUN';
			break;
		case 6:
			returnString = 'JUL';
			break;
		case 7:
			returnString = 'AUG';
			break;
		case 8:
			returnString = 'SEP';
			break;
		case 9:
			returnString = 'OCT';
			break;
		case 10:
			returnString = 'NOV';
			break;
		case 11:
			returnString = 'DEC';
			break;			
	}
	return returnString;
}

/** create weekday string for date label **/

function weekdayToStr(dateString) {
	var returnString = '';
	switch (dateString) {
		case 0:
			returnString = 'Sun';
			break;
		case 1:
			returnString = 'Mon';
			break;
		case 2:
			returnString = 'Tues';
			break;
		case 3:
			returnString = 'Wed';
			break;
		case 4:
			returnString = 'Thu';
			break;
		case 5:
			returnString = 'Fri';
			break;
		case 6:
			returnString = 'Sat';
			break;			
	}
	return returnString;
}

/**
 * Creates an unordered list of events in a human-readable form
 *
 * @param {json} root is the root JSON-formatted content from GData
 * @param {string} divId is the div in which the events are added
 */ 

function listEvents(root, divId) {
  var feed = root.feed;
  var events = document.getElementById(divId);
  var currentMonth = '';

  if (events.childNodes.length > 0) {
    events.removeChild(events.childNodes[0]);
  }	  

  // create a new unordered list
  var ul = document.createElement('ul');

  // loop through each event in the feed
  for (var i = 0; i < feed.entry.length; i++) {

	var startTime = '';
	var endTime = '';
    var entry = feed.entry[i];
    var title = entry.title.$t;
	var location = entry.gd$where[0].valueString;

	// set event type - default is speaking engagement
	var eventType = 'speakingEngagement';
	
	// if title contains string 'BTAN' event is of type 'BTAN'
	if (title.indexOf('BTAN') >= 0) {
		eventType = 'BTAN';
	} else if (entry.content.$t.indexOf('tradeshow') >= 0) {
		// if description contains the word 'tradeshow' event is of type 'tradeshow'
		eventType = 'tradeshow';
	}
	
	// get start and end dates
    var start = entry['gd$when'][0].startTime;
	var startArray = start.split('-');
	startArray[1] = (parseInt(startArray[1], 10) - 1)+'';
	if (startArray[2].indexOf('T') >= 0) {
		startTime = startArray[2].split('T')[1];
		var startHours = startTime.split(':')[0];
		var startMinutes = startTime.split(':')[1];
		startArray[2] = startArray[2].split('T')[0];
		var startDate = new Date(startArray[0], startArray[1], startArray[2]);
		startDate.setHours(startHours, startMinutes);
	} else {
		var startDate = new Date(startArray[0], startArray[1], startArray[2]);
	}
		
	var end = entry['gd$when'][0].endTime;
	var endArray = end.split('-');
	endArray[1] = (parseInt(endArray[1], 10) - 1)+'';
	if (endArray[2].indexOf('T') >= 0) {
		endTime = endArray[2].split('T')[1];
		var endHours = endTime.split(':')[0];
		var endMinutes = endTime.split(':')[1];	
		endArray[2] = endArray[2].split('T')[0];
		var endDate = new Date(endArray[0], endArray[1], endArray[2]);
		endDate.setHours(endHours, endMinutes);
	} else {
		var endDate = new Date(endArray[0], endArray[1], endArray[2]);
		endDate.setDate(endDate.getDate()-1);
	}

	var eventMonth = startDate.getMonth();

	// insert new month, if necessary
	if ((currentMonth != eventMonth) || ((currentMonth + '') == '')) {
		currentMonth = eventMonth + 0;
		var monthListItem = document.createElement('li');
		monthListItem.className = 'month';
		var monthTitle = document.createElement('h2');
		monthTitle.appendChild(document.createTextNode(monthToString(eventMonth) + " "));
		var yearSpan = document.createElement('span');
		yearSpan.appendChild(document.createTextNode(startDate.getFullYear()));
		monthTitle.appendChild(yearSpan);
		var eventList = document.createElement('ul');
		monthListItem.appendChild(monthTitle);
		monthListItem.appendChild(eventList);
		ul.appendChild(monthListItem);
	}
	

	
	// insert event
	var eventItem = document.createElement('li');
	eventItem.className = 'event';

	switch (eventType) {
		case 'BTAN':
			eventItem.className += ' btan';
			break;
		case 'tradeshow':
			eventItem.className += ' tradeshow';
			break;
		default:
			break;
	}
	
	// insert dates
	var eventDates = document.createElement('div');
	eventDates.className = 'dates';
	
	var eventStartDateContainer = document.createElement('p');
	var eventStartMonth = document.createElement('span');
	eventStartMonth.className = 'month';
	eventStartMonth.appendChild(document.createTextNode(monthToStr(eventMonth)));
	var eventStartDate = document.createElement('span');
	eventStartDate.appendChild(document.createTextNode(startDate.getDate()));
	eventStartDate.className = 'date';
	var eventStartWeekday = document.createElement('span');
	eventStartWeekday.className = 'weekday';
	eventStartWeekday.appendChild(document.createTextNode(weekdayToStr(startDate.getDay())));
	
	eventStartDateContainer.appendChild(eventStartMonth);
	eventStartDateContainer.appendChild(eventStartDate);
	eventStartDateContainer.appendChild(eventStartWeekday);
	
	eventDates.appendChild(eventStartDateContainer);

	// if endDate is different from startDate, insert endDate
	if (endDate.getDate() == startDate.getDate()) {
		eventDates.className += " singleDate"
	} else {
		var eventEndDateContainer = document.createElement('p');
		var eventEndMonth = document.createElement('span');
		eventEndMonth.className = 'month';
		eventEndMonth.appendChild(document.createTextNode(monthToStr(endDate.getMonth())));
		var eventEndDate = document.createElement('span');
		eventEndDate.appendChild(document.createTextNode(endDate.getDate()));
		eventEndDate.className = 'date';
		var eventEndWeekday = document.createElement('span');
		eventEndWeekday.className = 'weekday';
		eventEndWeekday.appendChild(document.createTextNode(weekdayToStr(endDate.getDay())));

		eventEndDateContainer.appendChild(eventEndMonth);
		eventEndDateContainer.appendChild(eventEndDate);
		eventEndDateContainer.appendChild(eventEndWeekday);

		eventDates.appendChild(eventEndDateContainer);
	}
	
	// insert event info	
	var eventInfo = document.createElement('div');
	eventInfo.className = 'info';
	
	var eventTitle = document.createElement('h3');
	eventTitle.appendChild(document.createTextNode(title));
	var eventAddress = document.createElement('p');
	eventAddress.appendChild(document.createTextNode(location));
	
	eventInfo.appendChild(eventTitle);
	eventInfo.appendChild(eventAddress);
	
	// if 1-day event has start and end times, insert here
	if (startTime != '' && endTime != '' && startDate.getDate() == endDate.getDate()) {
		var eventTime = document.createElement('p');
		eventTime.appendChild(document.createTextNode(
			((startDate.getHours()>12)?(startDate.getHours()-12):(startDate.getHours()===0?12:startDate.getHours())) 
			+ ':' + 
			((startDate.getMinutes()<10)?('0' + startDate.getMinutes()):(startDate.getMinutes())) 
			+ ' ' +  
			((startDate.getHours()>=12)?'PM':'AM') 
			+ ' - ' +  
			((endDate.getHours()>12)?(endDate.getHours()-12):(endDate.getHours()===0?12:endDate.getHours()))
			+ ':' + 
			((endDate.getMinutes()<10)?('0' + endDate.getMinutes()):(endDate.getMinutes()))
			+ ' ' +  
			((endDate.getHours()>=12)?'PM':'AM')
		));
		eventInfo.appendChild(eventTime);
	}

	// insert contact link
	var eventLink = document.createElement('a');

	if (eventType == 'BTAN') {
		eventLink.href = '/popup/contact-us-btan.html?date=' + start + '-' + end + '&title=' + title;
		eventLink.appendChild(document.createTextNode('REQUEST YOUR SEAT'));
	} else {
		eventLink.href = '/popup/contact-us-meeting.html?date=' + start + '-' + end + '&title=' + title;
		eventLink.appendChild(document.createTextNode('SET UP A MEETING'));
	}	

	$j(eventLink).addClass('iframe');
	$j(eventLink).fancybox({
		'hideOnContentClick': false,
		'width': 590,
		'height': 592,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});

	eventInfo.appendChild(eventLink);
	
	eventItem.appendChild(eventDates);
	eventItem.appendChild(eventInfo);
	
	eventList.appendChild(eventItem);
  }
  events.appendChild(ul);
}

/**
 * Callback function for the GData json-in-script call
 * Inserts the supplied list of events into a div of a pre-defined name
 * 
 * @param {json} root is the JSON-formatted content from GData
 */ 

function insertAgenda(root) {
  listEvents(root, 'eventsCalendar');
}

var $j=jQuery.noConflict();

var alertText = "Please be advised that you are leaving the BancVue.com. This link is provided as a courtesy. BancVue does not endorse or control the content of third party websites.";

var customFolder = "bancvue";

function confirmAlert(url){
			jConfirm(alertText, "Confirm", function(r) {
				if( r ){
					window.open(url);
				} else {
					return false;
			}
		});
		return false;
}

function confirmAlert2(url){
	if (!confirmAlert(url)) 
		return false; 
}


// <---Steve Pfister 8-25-11 
// This is just a function running the Fancybox for careers. I put this here because I was getting an error when i left it in the document.ready
function safariFancy(){
	$j('#availableJobs table a').addClass('iframe');
	$j("#availableJobs table a").fancybox({
		'hideOnContentClick': false,
		'width': 640,
		'height': 600,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});
}
// Steve Pfister 8-25-11 --->



$j(document).ready( function() {
	$j(".confirm").click( function() {						   
			if (!confirmAlert($j(this).attr('href'))){
				return false;			
			}
		}); 	

// replace fonts
		
	Cufon.set("selector", jQuery);
	Cufon.replace("ul.categoryList h2 span, .aboutContent .summary h2 span, #teamPlaceholder #placeholderIntro, #pressContent .summary #pressContact h2, h2#btanHighlights, #contactUs h1, #thankYou h1, #valuesList h3, #pressReleaseArchive h1, #sitemap h2, #error404Content #searchContainer h2, #contactUs #contactInfo h2, #privacyContent #columnRight h3, #alertContent #columnRight h3", {hover: true});
		
// Video Player Flash

if ($('videoPlayer')) {		
	var videoPlayerObject = new SWFObject('/custom/bancvue/flash/videoPlayer.swf', 'videoPlayerFlash', '620', '380', '9');
	videoPlayerObject.addVariable('video', queryObj.video);
	videoPlayerObject.addParam("wmode", "transparent");
	videoPlayerObject.write('videoPlayer');
}

// SWF Player Flash

if ($('swfPlayer')) {		
	var swfPlayerObject = new SWFObject('/custom/bancvue/flash/SWFPlayer-620x410.swf', 'videoPlayerFlash', '620', '410', '9');
	swfPlayerObject.addParam("wmode", "transparent");
	swfPlayerObject.write('swfPlayer');
}

// Homepage Flash

if ($('homeTabs')) {	
	$j('#mainContent').append('<div id="tickerContainer"><div id="ticker"> </div></div>');
	var homeTickerObject = new SWFObject('/custom/bancvue/flash/main-flipper-608x132-102511.swf', 'homeTickerFlash', '608', '132', '10');
	homeTickerObject.addParam("wmode", "transparent");	
	homeTickerObject.write('ticker');
}

// Accounts & Cards Flash

if ($('accountsContent')) {	
	var accountsTickerObject = new SWFObject('/custom/bancvue/flash/accounts-393x87-080311.swf', 'accountsTickerFlash', '393', '87', '10');
	accountsTickerObject.addParam("wmode", "transparent");
	accountsTickerObject.write('ticker');
}

// Online Marketing Flash

if ($('marketingContent')) {	
	var marketingTickerObject = new SWFObject('/custom/bancvue/flash/marketing-393x87.swf', 'marketingTickerFlash', '393', '87', '10');
	marketingTickerObject.addParam("wmode", "transparent");
	marketingTickerObject.write('ticker');
}
	
// Prefill Contact Us inputs

if ($j('input#meetingEvent') && queryObj.title) {
	var eventTitle = queryObj.title;
	while (eventTitle.indexOf('%20') > 0) {
		eventTitle = eventTitle.replace('%20',' ');
	}
	$j('input#meetingEvent').val(eventTitle);
}	

if ($j('input#meetingDate') && queryObj.date) {
	var eventDate = queryObj.date.split('-');
	$j('input#meetingDate').val(eventDate[1] + '/' + eventDate[2].split('T')[0] + '/' + eventDate[0]);
}

if ($j('input#btanDates') && queryObj.date) {
	var eventDate = queryObj.date.split('-');
	var endDay = eventDate[5].split('T')[0] - 1;
	if (endDay < 10) {
		endDay = '0' + endDay;
	}
	$j('input#btanDates').val(eventDate[1] + '/' + eventDate[2].split('T')[0] + '/' + eventDate[0] + ' - ' + eventDate[4] + '/' + endDay + '/' + eventDate[3]);
}

// super hovers and clickable containers

	var superHoverSet = $j("#marketingContent ul.categoryList li, #homeTabs dd, #searchResults tr, #accountsContent ul.categoryList li, #pressContent #columnCenter li ul li, #footer .promo");

	superHoverSet.css({cursor : "pointer"});
	
	superHoverSet.hover(function(){
		$j(this).find("a").addClass("hover");
		Cufon.refresh();
	},
	function(){
		$j(this).find("a").removeClass("hover");
		Cufon.refresh();
	});
	
	superHoverSet.click(function(){
		var url = $j(this).find('a').attr('href');
		if (url == 'https://www.bancvue.com/popup/contact-us-notify.html?page=53396&type=page&id=53396' || url == 'https://www.bancvue.com/popup/contact-us-notify.html')
			$j(this).find("a").trigger("click");
		else if ($j(this).find('a').attr('target') == '_blank')
			window.open(url);
		else
			window.location = url;
	});
	
// add tab effects for product pages
if ($('tabs'))
	crossFadeTabs('tabs');
	
// add tab effects for clients page
if ($('testimonials'))
	crossFadeTabs('testimonials');
	
// add tab effects for our work page
if ($('ourWorkGallery')) {
	crossFadeTabs('ourWorkGallery');
	if (queryObj.tab == 'kasasa') {
		$('kasasaLabel').fireEvent('click');
	}
	if (queryObj.tab == 'traditional') {
		$('traditionalLabel').fireEvent('click');
	}
}
	
// add tab effects for REALChecking products
if ($('accountTypes'))
	crossFadeHoverTabs('accountTypes');
	
// autorotating image galleries
if ($('photoGallery'))
	dotGallery('photoGallery');
	
if ($('fbGallery'))
	dotGallery('fbGallery');
	
if ($('kasasaVideos'))
	dotGallery('kasasaVideos');
	
if ($('clientsVideos'))
	dotGallery('clientsVideos');
	
// Press Articles Gallery

if ($('pressGallery'))
	dotGalleryPress('pressGallery');

// homepage banner
if ($('homeTabs')) {
	crossFadeHomeTabs('homeTabs');
}

// target="_blank"
	$j("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])")
	.attr("target","_blank").attr("title","Opens new window");
	
// fancybox - video player	
	var videoLinks = $j('#btanVideos a, #kasasaWorkGallery #kasasa-02 a, #kasasaWorkGallery #kasasa-03 a, #kasasaWorkGallery #kasasa-08 a, #kasasaContent li.results a, #kasasaContent li.basics a, #pressVideos a, #kasasaVideos a, #clientsVideos a, #moneyislandContent #mainImage a');
	videoLinks.addClass('iframe');
	videoLinks.fancybox({
		'hideOnContentClick': false,
		'width': 620,
		'height': 380,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'swf' : {
		   'wmode': 'opaque'
		},
		'titleShow': false,
		'transitionIn': 'elastic'
	});
	
// fancybox - SWF player	
	var swfLinks = $j('#kasasa360Link');
	swfLinks.addClass('iframe');
	swfLinks.fancybox({
		'hideOnContentClick': false,
		'width': 620,
		'height': 410,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});
	
// fancybox - Our Work - FIRSTBranch	
	$j('#firstbranchWorkGallery a, #firstbranchContent .results a').addClass('iframe');
	$j("#firstbranchWorkGallery a, #firstbranchContent .results a").fancybox({
		'hideOnContentClick': false,
		'width': 816,
		'height': 420,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});
	
// fancybox - Careers

// <--- Steve Pfister 8-25-11
	if ((navigator.appVersion.indexOf('Safari') == -1) || (navigator.appVersion.indexOf('Chrome') != -1)) {
		safariFancy();
	}
// Steve Pfister 8-25-11 --->
	
// fancybox - Press Release Archive	
	$j('#pressContent #columnRight .secondaryLink a').addClass('iframe');
	$j("#pressContent #columnRight .secondaryLink a").fancybox({
		'hideOnContentClick': false,
		'width': 560,
		'height': 600,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});
	
// fancybox - Our Work - Traditional & Kasasa Traditional
	var traditionalPopups = $j('#traditionalWorkGallery a, #kasasaWorkGallery #kasasa-01 a, #kasasaWorkGallery #kasasa-04 a, #kasasaWorkGallery #kasasa-06 a, #kasasaWorkGallery #kasasa-07 a, #kasasaWorkGallery #kasasa-09 a, #kasasaWorkGallery #kasasa-11 a, dd#realsaverContent .results a, dd#realtunesContent .results a');
	traditionalPopups.addClass('iframe');
	traditionalPopups.fancybox({
		'hideOnContentClick': false,
		'width': 816,
		'height': 614,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});

// fancybox - Contact

	var contactPopups = $j('#contactButton a, #contactUsProduct a, #accountsBVCA a, #clientsContent #CTA a, li#sitemapContact a, #careersContact a');
	contactPopups.addClass('iframe');
	contactPopups.fancybox({
		'hideOnContentClick': false,
		'width': 590,
		'height': 592,
		'overlayOpacity': 0.8,
		'overlayColor': '#000000',
		'padding': 0,
		'titleShow': false,
		'transitionIn': 'elastic'
	});	

// Our Work - Set up mp3 player

if ($('niftyPlayer1')) {	
	$j('#kasasa-05 a').click(function () {
		var niftyPlayer1 = niftyplayer('niftyPlayer1');
		if (niftyPlayer1.getState() == 'playing') {
			niftyPlayer1.pause();
			$j(this).find('.playPause').css({
				'background-position': '60px -82px'
			});
		} else {
			$j(this).find('.playPause').css({
				'background-position': '60px -182px'
			});
			niftyPlayer1.play();
			function checkPlaying1() {
				if (niftyPlayer1.getState() == 'finished') {
					$j('#kasasa-05 a .playPause').css({
						'background-position': '60px 30px'
					});
				} else {
					setTimeout(checkPlaying1, 1000);
				}	
			}
			setTimeout(checkPlaying1, 1000);
		}
		return false;
	});
}

if ($('niftyPlayer2')) {	
	$j('#kasasa-10 a').click(function () {
		var niftyPlayer2 = niftyplayer('niftyPlayer2');
		if (niftyPlayer2.getState() == 'playing') {
			niftyPlayer2.pause();
			$j(this).find('.playPause').css({
				'background-position': '60px -82px'
			});
		} else {
			$j(this).find('.playPause').css({
				'background-position': '60px -182px'
			});
			niftyPlayer2.play();
			function checkPlaying2() {
				if (niftyPlayer2.getState() == 'finished') {
					$j('#kasasa-10 a .playPause').css({
						'background-position': '60px 30px'
					});
				} else {
					setTimeout(checkPlaying2, 1000);
				}	
			}
			setTimeout(checkPlaying2, 1000);
		}
		return false;
	});
}

if ($('niftyPlayer3')) {	
	$j('#kasasa-12 a').click(function () {
		var niftyPlayer3 = niftyplayer('niftyPlayer3');
		if (niftyPlayer3.getState() == 'playing') {
			niftyPlayer3.pause();
			$j(this).find('.playPause').css({
				'background-position': '60px -82px'
			});
		} else {
			$j(this).find('.playPause').css({
				'background-position': '60px -182px'
			});
			niftyPlayer3.play();
			function checkPlaying3() {
				if (niftyPlayer3.getState() == 'finished') {
					$j('#kasasa-12 a .playPause').css({
						'background-position': '60px 30px'
					});
				} else {
					setTimeout(checkPlaying3, 1000);
				}	
			}
			setTimeout(checkPlaying3, 1000);
		}
		return false;
	});
}

// About Us - Awards Page

$j('#awardsList li li p').stop(true, true).fadeTo(10, 0);

$j('#awardsList li li').hover(function() {
	$j(this).find('p').stop(true, true).fadeTo(200, 0.9);
}, function() {
	$j(this).find('p').stop(true, true).fadeTo(200, 0);
});

// About Us - Careers Benefits

if ($j('#careersContent')) {
	$j('#careersContent .columnRight .columnContent li .benefitInfo').hide();
}

$j('#careersContent .columnRight .columnContent li.benefit').hoverIntent( function() {
	$j(this).css({
		'z-index': 5,
		'color': '#331169'
	});
	$j(this).addClass('active');
	$j(this).find('div.benefitInfo').stop(true, true).fadeIn(400);
}, function() {
	$j(this).css({
		'z-index': 4,
		'color': '#666'
	});
	$j(this).find('div.benefitInfo').stop(true, true).fadeOut(400, function() {
		$j(this).parent().removeClass('active');
	});
});

// About Us - Mission & Letter Switcher

if ($j('#aboutList')) {
	$j('#aboutList').height(708);
	$j('#aboutList #mission').css({
		'position': 'absolute',
		'top': 0,
		'left': 0
	});
	$j('#aboutList #letter').css({
		'position': 'absolute',
		'top': 4,
		'left': 61
	});
	$j('#aboutList #letter').hide();

	
	var letterLink = $j('<div class="switchLink"><a href="#letter">A Letter From Our CEO</a></div>');
	letterLink.click(function() {
		$j('#aboutList #mission').stop(true, true).fadeOut(400);
		$j('#missionLink').stop(true, true).fadeIn(400);
		$j('#aboutList #letter').stop(true, true).fadeIn(400, function() {
			$j('#aboutList').height(573);
		});
		return false;
	});
	
	$j('#aboutList #mission').append(letterLink);
	
	var missionLink = $j('<div id="missionLink" class="switchLink"><a href="#mission">Back To Our Mission</a></div>');
	missionLink.hide();
	missionLink.click(function() {
		$j('#aboutList #letter').stop(true, true).fadeOut(400);
		$j('#aboutList #mission').stop(true, true).fadeIn(400);
		$j('#missionLink').stop(true, true).fadeOut(400);
		$j('#aboutList').height(708);
		return false;
	});
	
	$j('#aboutTimelineContent').append(missionLink);
}

// Our Values - Patch Gallery

	var patchGalleryOpts = {
		align: 'bottom',
		distance: 120,
		fadeIn: 800,
		size: 80,
		step: 20		
	};
	
	$j('#patchGallery').jqDock(patchGalleryOpts);
	
// BTAN - Video Gallery

	var btanVideosOpts = {
		align: 'middle',
		distance: 120,
		fadeIn: 800,
		size: 157,
		step: 20		
	};

	$j('#btanVideos').jqDock(btanVideosOpts);
	
// Homepage Right Column

	var rightColumn = $j('#homeContent #columnRight');

	rightColumn.css({
		'background-image': 'url(/custom/bancvue/image/home-columnRight-bg.png)',
		'background-position': '0 0',
		'background-repeat': 'no-repeat'
	});

	rightColumn.find('p').css({
		'display': 'none',
		'margin': '-5px 9px 0'
	});
	
	rightColumn.find('#products p').css({
		'margin': '-1px 21px 0 9px'
	});
	
	rightColumn.find('#marketing p').css({
		'margin': '-5px 3px 2px 9px'
	});
	
	rightColumn.find('div').append('<a href="#" class="close">close</a>');

	rightColumn.find('div').hover(function(event) {
		var thisObject = $j(this);
		switch(thisObject.attr('id')) {
			case 'products':
				thisObject.parent().css({
					'background-position': '-269px 0'
				});
				break;
			case 'marketing':
				thisObject.parent().css({
					'background-position': '-538px 0'
				});
				thisObject.css({
					'padding-top': 12
				});
				break;
			case 'consulting':
				thisObject.parent().css({
					'background-position': '-807px 0'
				});
				thisObject.css({
					'padding-top': 12
				});
				break;
			case 'training':
				thisObject.parent().css({
					'background-position': '-1076px 0'
				});
				thisObject.css({
					'padding-top': 12
				});
				break;
		}
		thisObject.siblings().css({
			'padding-top': 0
		});
		thisObject.siblings('#headline').stop(true, true).hide();
		thisObject.siblings().find('p, a.close').stop(true, true).hide();
		thisObject.find('h2').css({
			'background-position': '0 -25px',
			'margin-bottom': 13
		});
		thisObject.find('p, a.close').stop(true, true).fadeIn();
		thisObject.siblings().find('h2').css({
			'background-position': '0 -50px',
			'margin-bottom': 13
		});
	}, function(event) {
		event.stopPropagation();
	});
	
	rightColumn.find('a.close').hide().click(function() {
		$j(this).stop(true,true).hide();
		var grandparent = $j(this).parent().parent();
		grandparent.find('p').stop(true,true).hide();
		grandparent.find('div').css({
			'padding-top': 0
		});
		grandparent.find('h2').css({
			'background-position': '0 0',
			'margin-bottom': 20
		});
		grandparent.css({
			'background-position': '0 0'
		});
		grandparent.find('#headline').stop(true, true).fadeIn();
	});

// Timeline

if ($('timeline')) {
	
	// Set up background
	
	$j('#introContent').css({
		'background': 'url("/custom/bancvue/image/about-timeline-bg-060611.png") no-repeat scroll 10px 0 transparent',
		'height': 207,
		'padding-top': 26
	});
	
	$j('#aboutTimelineContent #shadowHiderLeft, #aboutTimelineContent #shadowHiderRight').css({
		'top': 270,
		'height': 200	
	});
	
	// Set up milestones
	$j('#timeline').addClass('timelineActive');
	$j('#timeline li p').hide();
	$j('#timeline li a.timelineTrigger').hoverIntent( function() {
		clearTimeout(glowTimeout);
		$j(this).siblings().fadeIn(200);
		$j(this).parent().css({
			'z-index': 7
		});
	}, function() {
		$j(this).parent().css({
			'z-index': 6
		});
	});
	$j('#timeline li').hoverIntent( function() {
		return true;
	}, function() {
		if ($j(this).hasClass('awards')) {
			$j(this).find('div ol,div ul').stop(true,true).fadeOut(200).parent().delay(200).fadeOut(200);
		} else {
			$j(this).find('p').stop(true,true).fadeOut(200);
		}
		glowTimeout = setTimeout(glow,600);
	});

	// Set up awards

	if ($('timeline2008AwardsContent'))
		dotGallery('timeline2008AwardsContent');
	if ($('timeline2009AwardsContent'))
		dotGallery('timeline2009AwardsContent');
	if ($('timeline2010AwardsContent'))
		dotGallery('timeline2010AwardsContent');
	if ($('timeline2011AwardsContent'))
		dotGallery('timeline2011AwardsContent');

	$j('#timeline li.awards div').hide();
	$j('#timeline li.awards div ol').hide();
	$j('#timeline li.awards h4').hoverIntent( function() {
		clearTimeout(glowTimeout);
		$j(this).siblings().fadeIn(200).find('ol').delay(300).fadeIn(200).siblings().fadeIn(200);
		$j(this).parent().css({
			'z-index': 7
		});
	}, function() {
		$j(this).parent().css({
			'z-index': 6
		});
	});

	// Set up blinking targets

	$j('#timeline li a.timelineTrigger span').hide();

	function glow() {
		var glowTarget;
		var maxTargets = 46;
		var randomTargetNumber = Math.floor(Math.random()*maxTargets+1);
		switch (randomTargetNumber) {
			case 1:
				glowTarget = $j('#timeline2004-1');
				break;
			case 2:
				glowTarget = $j('#timeline2005-1');
				break;
			case 3:
				glowTarget = $j('#timeline2006-1');
				break;
			case 4:
				glowTarget = $j('#timeline2006-2');
				break;
			case 5:
				glowTarget = $j('#timeline2006-3');
				break;
			case 6:
				glowTarget = $j('#timeline2007-1');
				break;
			case 7:
				glowTarget = $j('#timeline2007-2');
				break;
			case 8:
				glowTarget = $j('#timeline2008-1');
				break;
			case 9:
				glowTarget = $j('#timeline2008-2');
				break;
			case 10:
				glowTarget = $j('#timeline2008-3');
				break;
			case 11:
				glowTarget = $j('#timeline2009-1');
				break;
			case 12:
				glowTarget = $j('#timeline2009-2');
				break;
			case 13:
				glowTarget = $j('#timeline2009-3');
				break;
			case 14:
				glowTarget = $j('#timeline2009-4');
				break;
			case 15:
				glowTarget = $j('#timeline2009-5');
				break;
			case 16:
				glowTarget = $j('#timeline2010-1');
				break;
			case 17:
				glowTarget = $j('#timeline2010-2');
				break;
			case 18:
				glowTarget = $j('#timeline2010-3');
				break;
			case 19:
				glowTarget = $j('#timeline2010-4');
				break;
			case 20:
				glowTarget = $j('#timeline2010-5');
				break;
			case 21:
				glowTarget = $j('#timeline2010-6');
				break;
			case 22:
				glowTarget = $j('#timeline2010-7');
				break;
			case 23:
				glowTarget = $j('#timeline2010-8');
				break;	
		}
		if (glowTarget) {
			glowTarget.find('a.timelineTrigger span').fadeIn(1200).fadeOut(1200);
		}
		glowTimeout = setTimeout(glow,600);
	}

	var glowTimeout = setTimeout(glow,600);
}
	
// Our Team

	teamBuilder($j('#teamContainer'));
	
// Values - Interactive Patch

if ($('valuesList')) {
	
	var patchTriggers = $j('#valuesList  #interdependence, #valuesList #leadership, #valuesList #love, #valuesList #badassitude');
	$j('#valuesList').find('li p').hide();
	$j('#valuesList').find('li p').css({
		'padding': 5,
		'background-color': '#FFF'
	});
	$j('#valuesList').find('li').css({
		'padding': 5,
		'position': 'absolute'
	});
	$j('#valuesList').find('li h3').css({
		'background': 'transparent'
	});
	patchTriggers.css({
		'margin': 0,
		'background-color': '#D4844D'
	});
	patchTriggers.append('<div class="arrow"> </div><div class="plus"> </div>');
	patchTriggers.addClass('inactive');
	$j('#valuesList #interdependence').css({
		'width': 189,
		'left': 80,
		'top': 135
	});
	$j('#valuesList #leadership').css({
		'width': 189,
		'left': 477,
		'top': 134
	});
	$j('#valuesList #love').css({
		'width': 125,
		'left': 469,
		'top': 359
	});
	$j('#valuesList #badassitude').css({
		'width': 151,
		'left': 115,
		'top': 403
	});	
	
	$j('#valuesList #interdependence').hoverIntent(function() {
		$j(this).removeClass('inactive');
		$j(this).css({
			'width': 244
		});
		$j(this).find('div.plus').stop(true, true).hide();
		$j(this).stop(true, true).animate({
				'left': 36,
				'top': 26
		}, 600);
		$j(this).find('.arrow').stop(true, true).animate({
			'top': 80
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#999'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 -19px'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 -40px'
		});
		$j(this).find('p').stop(true, true).show(600);
		$j('#interdependenceGraphic').stop(true, true).delay(600).fadeIn(600);
	}, function() {
		$j(this).css({
			'background-color': '#D4844D'
		});
		$j(this).find('div.plus').stop(true, true).show();
		$j(this).addClass('inactive');
		$j(this).stop(true, true).animate({
			'left': 80,
			'top': 135,
			'width': 189
		}, 600);
		$j(this).find('.arrow').stop(true, true).animate({
			'top': 9
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#D4844D'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 0'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 0'
		});
		$j(this).find('p').stop(true, true).hide(600);
		$j('#interdependenceGraphic').stop(true, true).fadeOut(600);
	});
	
	$j('#valuesList #leadership').hoverIntent(function() {
		$j(this).removeClass('inactive');
		$j(this).find('div.plus').stop(true, true).hide();
		$j(this).animate({
				'left': 346,
				'width': 334
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#999'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 -19px'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 -40px'
		});
		$j(this).find('p').stop(true, true).delay(600).show(600);
		$j('#leadershipGraphic').stop(true, true).delay(600).fadeIn(600);
	}, function() {
		$j(this).css({
			'background-color': '#D4844D'
		});
		$j(this).find('div.plus').stop(true, true).show();
		$j(this).addClass('inactive');
		$j(this).stop(true, true).animate({
			'left': 477,
			'width': 189
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#D4844D'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 0'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 0'
		});
		$j(this).find('p').stop(true, true).hide(600);
		$j('#leadershipGraphic').stop(true, true).fadeOut(600);
	});

	$j('#valuesList #badassitude').hoverIntent(function() {
		$j(this).removeClass('inactive');
		$j(this).css({
			'width': 540
		});
		$j(this).find('div.plus').stop(true, true).hide();
		$j(this).stop(true, true).animate({
				'left': 107
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#999'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 -19px'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 -40px'
		});
		$j(this).find('p').stop(true, true).show(600);
		$j('#badassitudeGraphic').stop(true, true).delay(600).fadeIn(600);
	}, function() {
		$j(this).css({
			'background-color': '#D4844D'
		});
		$j(this).find('div.plus').stop(true, true).show();
		$j(this).addClass('inactive');
		$j(this).stop(true, true).animate({
			'left': 115,
			'width': 151
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#D4844D'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 0'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 0'
		});
		$j(this).find('p').stop(true, true).hide(600);
		$j('#badassitudeGraphic').stop(true, true).fadeOut(600);
	});
	
	$j('#valuesList #love').hoverIntent(function() {
		$j(this).removeClass('inactive');
		$j(this).css({
			'width': 215
		});
		$j(this).find('div.plus').stop(true, true).hide();
		$j(this).stop(true, true).animate({
				'top': 256
		}, 600);
		$j(this).find('.arrow').stop(true, true).animate({
			'top': 110
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#999'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 -19px'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 -40px'
		});
		$j(this).find('p').stop(true, true).show(600);
		$j('#loveGraphic').stop(true, true).delay(600).fadeIn(600);
	}, function() {
		$j(this).css({
			'background-color': '#D4844D'
		});
		$j(this).find('div.plus').stop(true, true).show();
		$j(this).addClass('inactive');
		$j(this).stop(true, true).animate({
			'top': 359,
			'width': 125
		}, 600);
		$j(this).find('.arrow').stop(true, true).animate({
			'top': 12
		}, 600);
		$j(this).siblings('.patchTrigger').css({
			'background-color': '#D4844D'
		});
		$j(this).siblings('.patchTrigger').find('.plus').css({
			'background-position': '0 0'
		});
		$j(this).siblings('.patchTrigger').find('.arrow').css({
			'background-position': '0 0'
		});
		$j(this).find('p').stop(true, true).hide(600);
		$j('#loveGraphic').stop(true, true).fadeOut(600);
	});
	
	function fadePlus () {
		$j('#valuesList .inactive div.plus').fadeTo(2000, .50).fadeTo(2000, 1.0, function() {
			fadePlus();
		});
	}
	
	fadePlus();
}

// No Search Results

if (($j('#searchResults').length > 0) && ($j('#searchResults td').length == 0)) {
	$j('#noResults').show();
}


// PNGfix - IE6 only

	if (jQuery.browser.msie && (jQuery.browser.version < 7)) {
		// Make links clickable, turn off if things are positioning strangely, but check all links
		var applyPositioning = true;

		// Path to a transparent GIF image
		var shim = '/custom/bancvue/image/pixel.gif';

		// Add all image elements using transparent png and all elements with transparent png backgrounds to this array
		var targets = $$(".pngfix","#teamContainer .bioContainer");

		targets.each(function(obj) {
			if (obj.tagName == 'IMG') {
				var src = obj.src;
				obj.style.width = obj.width + "px";
				obj.style.height = obj.height + "px";
				obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
				obj.src = shim;
			} else {
				var mode = 'scale';
				var bg	= obj.currentStyle.backgroundImage;
				var src = bg.substring(5,bg.length-2);
				if (obj.currentStyle.backgroundRepeat == 'no-repeat') {
					mode = 'crop';
				}
				obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')";
				obj.style.backgroundImage = 'url('+shim+')';
				if (applyPositioning) {
					var childElements = $$(obj.getElementsByTagName("*"));
					childElements.each(function(childObj) {
						if ((childObj.tagName=='A' || childObj.tagName=='INPUT') && childObj.style.position === '') {
							childObj.style.position = 'relative';
						}	
					});
				}
			}
		});

	}

	
// animate secondary links
	$j('#choicecheckingContent li.results a, #moneyviewContent li.results a, #kasasaContent li.results a, #kasasaContent li.basics a, #checkingfinderContent li.results a, #firstbranchContent li.results a, #eventsCalendar li.event a, #clientsContent #CTA a, #careersContact a, #productTabs .secondaryLink a, #footer .promo .secondaryLink a, #rcsContent ul.basicsBenefitsResults li.results a, #workContent #columnRight a, #pressContent #columnRight a, #inmoContent ul.basicsBenefitsResults li.results a, #fbGallery a, ul.categoryList li.bvca a, #aboutList a, #missionLink a, #homeContent #siteAlert p a').hover(function() {
		$j(this).stop(true, true).animate({
			'padding-right': 18
		},100);
	}, function() {
		$j(this).stop(true, true).animate({
			'padding-right': 14
		},100);
	});

});
