﻿// 2007-12-14 Create By Sean Cheng
var SC ;
if (!SC) SC = {};

SC.SlidingPanels = function(element, countItem, fullItem, pervEle, nextEle) {
	// must load Spry/widgets/slidingpanels/SprySlidingPanels.js first.
	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() ; 
		}
	}
}

// 2008-08-26
function func_NextSlide(objImg, objLink, arrImages, arrLinks, numNowIndex) {
    document.getElementById(objImg).style.filter = "blendTrans(duration=2)";
    if (document.all) {
        document.getElementById(objImg).filters.blendTrans.duration = 1;
        document.getElementById(objImg).filters.blendTrans.Apply();
    }

    document.getElementById(objImg).src = arrImages[numNowIndex];
    if (document.all) {
        document.getElementById(objImg).filters.blendTrans.Play();
    }

    document.getElementById(objLink).href = arrLinks[numNowIndex];
}

// 2009-03-06
function func_ZoomoutImage(img) {
    img._w = img.width;
    img._h = img.height;
    img.style.width = img.width * 1.15 + 'px';
    img.style.height = img.height * 1.15 + 'px';
}
function func_ZoominImage(img) {
    img.style.width = img._w + 'px';
    img.style.height = img._h + 'px';
}