﻿// 2007-12-14 Create By Sean Cheng
var SC ;
if (!SC) SC = {};

SC.SlidingPanels = function(element, countItem, fullItem, pervEle, nextEle) {
	var oSliding = new Spry.Widget.SlidingPanels(element) ;
	var intIndex = 1 ; 
	func_Init() ;
	
	function func_Init() {
		document.getElementById(pervEle).style.display='' ;
		document.getElementById(nextEle).style.display='' ;
		
		if ( countItem - intIndex + 1 > fullItem ) {
			document.getElementById(nextEle).style.display='' ;
		} else {
			//document.getElementById(nextEle).style.display='none' ;
		}
		if ( intIndex > 1 ) {
			document.getElementById(pervEle).style.display='' ;
		} else {
			//document.getElementById(pervEle).style.display='none' ;
		}
	}
	this.SlideToNext  = function() {
		if ( countItem - intIndex + 1 > fullItem ) {
			oSliding.showNextPanel(); 
			intIndex++ ; 
			func_Init() ;
		}
	}
	this.SlideToPrevious = function() {
		if ( intIndex > 1 ) {
			oSliding.showPreviousPanel(); 
			intIndex-- ;
			func_Init() ; 
		}
	}
}