<!--								PSEG Careers								-->
<!-- __________________________________________________________________________	-->
<!--  Author: 	Eric Birnbaum													-->
<!--  Version	|	Date	|	Notes											-->
<!-- __________________________________________________________________________	-->
<!--  	1.0		| 03/23/08	|	code for handling jquery tabs in Diversity		-->
<!--  	1.01	| 04/14/09	|	-removed animation effect when clicking anchor	-->
<!-- 			|			|	 links inside a tab								-->
<!-- 			|			|	-fixed anchor link positioning of clicked 		-->
<!-- 			|			|	 content										-->
<!-- 	1.02	| 04/30/09	|	fixed sliderActive() code for calendars			-->
<!-- __________________________________________________________________________	-->
<!-- 						BERNARD HODES GROUP	© 2009							-->
<!-- 							http://www.hodes.com/							-->
<!-- __________________________________________________________________________	-->

$(document).ready(function() {
	
	var currentNode;

//***	Object Creation	***/

	$("#tabs").tabs({
		select: function(event, ui) {
			$('#content-slider').slider('option', 'value', 0);
			//$('#content-scroll').scrollTop(1);
		},
		show: function(event, ui) {
			currentNode = ui.panel;
			sliderActive(currentNode);	
			$('#content-scroll').scrollTop(1);
		},
		fx: { opacity: 'toggle' }
	});
	
	$("#content-slider").slider({
		orientation: "vertical",
		min:-100,
		max:0,
		slide: handleSliderSlide
		//change: handleSliderChange,animate: true,value: 100
	});

//***	Events	***/

	$("div#print_button").click (function() {
		$(currentNode).printArea();
	});	
	
	$(".ui-tabs-panel a[href^='#']").click (function () {
		elementClick = $(this).attr("href");
		destination = $(elementClick).offset().top - $(currentNode).offset().top; //- $("#content-scroll").offset().top;			
		var slideValue = -destination  / $(currentNode).height() * 100;
		$("#content-scroll").attr({ scrollTop: destination});
		$('#content-slider').slider('option', 'value', slideValue);  
		return false;
	});
	
	/*$("#content-scroll").scroll (function() {
		var slideValue = 100 - Math.round($("#content-scroll").scrollTop()  / $(currentNode).height() * 100);
		//$.log($("#content-scroll").scrollTop() + "   :   " + $(currentNode).height() );
		$('#content-slider').slider('option', 'value', slideValue);  
	});*/

//***	Functions	***/

	function sliderActive(mc) {
		if ($(mc).height() < $('#content-scroll').height()) { $('#content-slider').slider('disable');}
		else { $('#content-slider').slider('enable');}
	}
	
	function handleSliderChange(e, ui) {
		var maxScroll = $("#content-scroll").attr("scrollHeight") - $("#content-scroll").height();
		$("#content-scroll").animate({ scrollTop: -ui.value * (maxScroll / 100)}, 1000);
	}
	
	function handleSliderSlide(e, ui) {	
		var maxScroll = $("#content-scroll").attr("scrollHeight") - $("#content-scroll").height();
		$("#content-scroll").attr({ scrollTop: -ui.value * (maxScroll / 100)});
	}

//***	Initialize	**/

	 if (typeof(eval(window)['skipBool']) == 'undefined') {
	//if (skipBool == 'undefined') {
		sliderActive('#tabs-1');
		
	} else {
		sliderActive('#content-scroll > span');
	}
	
	//DEBUG = true; //ex: $.log('string');
});
-->