// JavaScript Document
var docReady = false;
$j(document).ready(function() {
	
	if(!docReady){
		initNumericPaging();
		initFooterPaging();
	}
	docReady = true;
});

function initNumericPaging(){
	
	//var currentPosition = 0;
	if(typeof(totalNumericPages) == 'undefined'){
		return;
	}
	//#041637
	$j(".pageControlsNumber").hover(function() {
		
		if($j(this).attr('class') != 'pageControlsNumber current') {
			
			$j(this).children().each(function() {
				$j(this).css({'color': '#f47238'});
			});
		}
		
	}, function() {
		if($j(this).attr('class') != 'pageControlsNumber current') {
			
			$j(this).children().each(function() {
				$j(this).css({'color': '#000000'});
			});
		}
	});

	$j(".pageControlsNextNumeric").click(function() {
												 
		if($j(this).hasClass('enabled')) {
			var kids = $j(this).children();
			window.location.href= $j(kids[0]).attr('href');
			return false;
		}
	
	});
	
	$j(".pageControlsPreviousNumeric").click(function() {
		if($j(this).hasClass('enabled')) {
			var kids = $j(this).children();
			window.location.href= $j(kids[0]).attr('href');
			return false;
		}
	
	
	});
	
}

var setNumericClasses = function() {
	$j(".pageControlsNextNumeric").removeClass('enabled');
	$j(".pageControlsPreviousNumeric").removeClass('enabled');
	if (currentPosition > 1) {
		$j(".pageControlsPreviousNumeric").addClass("enabled");
	} else {
		$j(".pageControlsPreviousNumeric").addClass("disabled");
	}
	if (currentPosition < totalNumericPages) {
		$j(".pageControlsNextNumeric").addClass("enabled");
	} else {
		$j(".pageControlsNextNumeric").addClass("disabled");
	}
}

function getNextPage() {
	
	var curr = $j('.pageControlsNumber.current').text();
	console.log(curr);
}

function getPrevPage() {
	
	var curr = $j('.pageControlsNumber.current').text();
	
	
}

function initFooterPaging() {
	$j("#footerNextLink.enabled").click(
			function() {
				var url = $j("#footerNextLink.enabled>a").attr('href');
				window.location.href = url;
			}
	 );
	
	$j("#footerPreviousLink.enabled").click(
			function() {
				var url = $j("#footerPreviousLink.enabled>a").attr('href');
				window.location.href = url;
			}
	 );
	
}

	