/* main page video box (domestic & intl)
===================================================================== */
var CurPage = 1;
var Lock = false;
function Blur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * Next() and Prev()
 * are called from previous and next buttons
 */
function Next( lnk ) {
	Blur( lnk );
	if((CurPage < 3)&&(!Lock)) {
		SlideLeft();
	}
}

function Prev( lnk ) {
	Blur( lnk );
	if((CurPage > 1)&&(!Lock)) {
		SlideRight();
	}
}

/*
 * Page( intPage )
 * called from clicking on gray dot icon
 */
function Page( intPage, lnk ) {
	Blur( lnk );
	if((CurPage != intPage)&&(!Lock)) {
		if(CurPage < intPage) {
			if((intPage - CurPage) > 1) {
				SlideDoubleLeft();
			}
			else {
				SlideLeft();
			}
		}
		else {
			if((CurPage - intPage) > 1) {
				SlideDoubleRight();
			}
			else {
				SlideRight();
			}
		}
	}
}

function MouseOver( id ) {
	for(i=1;i<4;i++) {
	$(id).src = '/member-central/images/index/toggle-btn-'+i+'-over.png';
	}
}

function Locker( intDur ) {
	var LockerTime = intDur * 100;
	Lock = true;
	setTimeout(function() { Lock = false; },LockerTime);
}
function SlideLeft() {
	Locker(3);
	new Effect.MoveBy( 'mainGraphic0', 0, -956 , {duration: 0.3} );
	new Effect.MoveBy( 'mainGraphic1', 0, -956 , {duration: 0.3} );
	new Effect.MoveBy( 'mainGraphic2', 0, -956 , {duration: 0.3} );
	CurPage++;
	MoveDot();
	UpdateBtns();
}

function SlideDoubleLeft() {
	Locker(6);
	new Effect.MoveBy( 'mainGraphic0', 0, -1912 , {duration: 0.001} );
	new Effect.MoveBy( 'mainGraphic1', 0, -1912 , {duration: 0.001} );
	new Effect.MoveBy( 'mainGraphic2', 0, -1912 , {duration: 0.001} );
	CurPage++;
	CurPage++;
	MoveDot();
	UpdateBtns();
}

function SlideRight() {
	Locker(3);
	new Effect.MoveBy( 'mainGraphic0', 0, 956 , {duration: 0.3} );
	new Effect.MoveBy( 'mainGraphic1', 0, 956 , {duration: 0.3} );
	new Effect.MoveBy( 'mainGraphic2', 0, 956 , {duration: 0.3} );
	CurPage--;
	MoveDot();
	UpdateBtns();
}

function SlideDoubleRight() {
	Locker(6);
	new Effect.MoveBy( 'mainGraphic0', 0, 1912 , {duration: 0.001} );
	new Effect.MoveBy( 'mainGraphic1', 0, 1912 , {duration: 0.001} );
	new Effect.MoveBy( 'mainGraphic2', 0, 1912 , {duration: 0.001} );
	CurPage--;
	CurPage--;
	MoveDot();
	UpdateBtns();
}

// image change functions
function MoveDot() {
	for(i=1;i<4;i++) {
		$('Btn'+i).src = '/member-central/images/index/toggle-btn-'+i+'.png';
		
	}
	$('Btn'+CurPage).src = '/member-central/images/index/toggle-btn-'+CurPage+'-over.png';
	$('Btn'+CurPage).onmouseover = function() {}
	$('Btn'+CurPage).onmouseout = function() {}
}
function UpdateBtns() {
	if(CurPage > 1) {
		$('BtnL').style.cursor ='auto';
		$('BtnL').src = '/member-central/images/index/toggle-left-over.png';
		$('BtnL').onmouseover = function() { this.src='/member-central/images/index/toggle-left-over.png'; }
		$('BtnL').onmouseout = function() { this.src='/member-central/images/index/toggle-left.png'; }
	}
	else {
		$('BtnL').style.cursor ='default';
		$('BtnL').src = '/member-central/images/index/toggle-left.png';
		$('BtnL').onmouseover = function() {}
		$('BtnL').onmouseout = function() {}
	}

	if(CurPage < 3) {
		$('BtnR').style.cursor ='auto';
		$('BtnR').src = '/member-central/images/index/toggle-right-over.png';
		$('BtnR').onmouseover = function() {this.src = '/member-central/images/index/toggle-right-over.png';}
		$('BtnR').onmouseout = function() {this.src = '/member-central/images/index/toggle-right.png';}
	}
	else {
		$('BtnR').style.cursor ='default';
		$('BtnR').src = '/member-central/images/index/toggle-right.png';
		$('BtnR').onmouseover = function() {}
		$('BtnR').onmouseout = function() {}
	}
}
/* end main page video box
===================================================================== */
