(function() {

	$.fn.podSlideshow = function(options) {
		var opts = $.extend({}, $.fn.podSlideshow.defaults, options);
		return this.each(function() {
			$this = $(this);
			var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
			
			$this.find('ul.slideshow li:first').addClass('active');
			$('ul.pagination li a[href=#'+$('ul.slideshow li.active').attr('id')+']').addClass('active');
			
			$this.find('ul.pagination li a').click(function() {
				$link = $(this);
				if(!$this.find($link.attr('href')).hasClass('active')) {
					$link.addClass('active').parent().siblings().find('a').removeClass('active');
					$this.find('ul.slideshow li.active').fadeOut('fast', function() {
						$(this).removeClass('active');
						$this.find($link.attr('href')).fadeIn('fast', function() {
							$(this).addClass('active');
						});
					});
					return false;
				}
			});
			
		});
	};

})(jQuery);

(function() {

	$.fn.selectReplace = function(options) {
		if(!($.browser.msie && $.browser.version < 7)) {
			var opts = $.extend({}, $.fn.selectReplace.defaults, options);
			return this.each(function() {
				var $this = $(this);
				var o = $.meta ? $.extend({}, opts, $this.data()) : opts;

				$this.wrap('<span id="'+$this.attr('id')+'_wrapper" class="select_wrapper"></span>').before('<span>'+$this.find('option[value='+$this.val()+']').html()+'</span>');
				$this.css("opacity", 0);

				$this.change(function() {
					$this.parent().find('span').html($this.find('option[value='+$this.val()+']').html());
				}).hover(function() {
					$this.css('cursor','pointer');
				}, function() {
					$this.css('cursor','default');
				});

			});
		}
	};

})(jQuery);

(function() {

	$.fn.submitReplace = function(options) {
		var opts = $.extend({}, $.fn.submitReplace.defaults, options);
		return this.each(function() {
			var $this = $(this);
			var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
			
			$this.wrap('<span class="submit_wrapper"></span>');
			$this.css('opacity',0);
			$this.hover(function() {
				$this.css('cursor','pointer');
			}, function() {
				$this.css('cursor','default');
			});
			
		});
	};

})(jQuery);

(function() {

	$.fn.addHoverClass = function(options) {
		var opts = $.extend({}, $.fn.addHoverClass.defaults, options);
		return this.each(function() {
			var $this = $(this);
			var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
			
			$this.hover(function() {
				$(this).addClass('hover');
			}, function() {
				$(this).removeClass('hover');
			});
			
		});
	};
})(jQuery);


/* FOR LAYOUT TEST ONLY */

$.fn.fpoVideoOverlay = function() {
	$(this).click(function() {
		$('body').append('<div class="modal_overlay video_player"><div class="modal_overlay_content"><p class="flash_content"><img src="/images/corporate/fpo/fpo.video-player.jpg" alt="FPO"></img></p><h4><strong>BK</strong><sup>&reg;</sup> Scholars Day in the Sun</h4><p class="call_to_action"><a href="BK_TEST" class="utility">See More Videos</a></p></div><p class="dismiss"><a href="BK_TEST">close</a></p></div><div class="UIBlock"></div>');
		
		$('.dismiss a').click(function() {
			$('.UIBlock, .modal_overlay').remove();
			return false;
		});
		return false;
	});
};



$(document).ready(function() {

    //No Slideshow,Thumpnail etc on Career Section so commenting
	//$('div.slideshow').podSlideshow();
	
	//$('p.video_thumbnail a').append('<span class="overlay">Play</span>');
	//$('p.video_thumbnail a').fpoVideoOverlay();
	
	//$('#stock_ticker select, .Press .tabbed .pod_content form select').selectReplace();
	//$('#stock_ticker input[type=submit], #press_releases input[type=submit], .tabbed .pod_tools input[type=submit], .Promotions input[type=submit]').submitReplace();
	
	//$('.tabbed .pod_header ul li').addHoverClass();
	

});
