/* main page video box (domestic & intl) 
===================================================================== */
var cnnMpVpCurPage = 1;
var cnnMpVpLock = false;
function cnnMpVpBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * cnnMpVpNext() and cnnMpVpPrev()
 * are called from previous and next buttons
 */
function cnnMpVpNext( lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage < 3)&&(!cnnMpVpLock)) {
		cnnMpVpSlideLeft();
	}
}

function cnnMpVpPrev( lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage > 1)&&(!cnnMpVpLock)) {
		cnnMpVpSlideRight();
	}
}

/*
 * cnnMpVpPage( intPage )
 * called from clicking on gray dot icon
 */
function cnnMpVpPage( intPage, lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage != intPage)&&(!cnnMpVpLock)) {
		if(cnnMpVpCurPage < intPage) {
			if((intPage - cnnMpVpCurPage) > 1) {
				cnnMpVpSlideDoubleLeft();
			}
			else {
				cnnMpVpSlideLeft();
			}
		}
		else {
			if((cnnMpVpCurPage - intPage) > 1) {
				cnnMpVpSlideDoubleRight();
			}
			else {
				cnnMpVpSlideRight();
			}
		}
	}
}

function cnnLockMpVp( intDur ) {
	var cnnLockDur = intDur * 100;
	cnnMpVpLock = true;
	setTimeout(function() { cnnMpVpLock = false; },cnnLockDur);
}
function cnnMpVpSlideLeft() {
	cnnLockMpVp(3);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, -336 , {duration: 0.3} );
	cnnMpVpCurPage++;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideDoubleLeft() {
	cnnLockMpVp(6);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, -672 , {duration: 0.6} );
	cnnMpVpCurPage++;
	cnnMpVpCurPage++;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideRight() {
	cnnLockMpVp(3);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, 336 , {duration: 0.3} );
	cnnMpVpCurPage--;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideDoubleRight() {
	cnnLockMpVp(6);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, 672 , {duration: 0.6} );
	cnnMpVpCurPage--;
	cnnMpVpCurPage--;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpDotMouseOver( id ) {
	$(id).src = 'img/icones/gray_active_status.gif';
}

// image change functions
function cnnMpVpMoveDot() {
	for(i=1;i<4;i++) {
		$('cnnMpVidDot'+i).src = 'img/icones/gray_status.gif';
		$('cnnMpVidDot'+i).onmouseover = function() {this.src = 'img/icones/gray_active_status.gif';}
		$('cnnMpVidDot'+i).onmouseout = function() {this.src = 'img/icones/gray_status.gif';}
	}
	$('cnnMpVidDot'+cnnMpVpCurPage).src = 'img/icones/gray_active_status.gif';
	$('cnnMpVidDot'+cnnMpVpCurPage).onmouseover = function() {}
	$('cnnMpVidDot'+cnnMpVpCurPage).onmouseout = function() {}
}
function cnnMpVpUpdateBtns() {
	if(cnnMpVpCurPage > 1) {
		$('cnnMpVidBtnL').style.cursor ='auto';
		$('cnnMpVidBtnL').src = 'img/icones/left_red_btn.gif';
		$('cnnMpVidBtnL').onmouseover = function() { this.src='img/icones/left_red_over_btn.gif'; }
		$('cnnMpVidBtnL').onmouseout = function() { this.src='img/icones/left_red_btn.gif'; }
	}
	else {
		$('cnnMpVidBtnL').style.cursor ='default';
		$('cnnMpVidBtnL').src = 'img/icones/left_gray_btn.gif';
		$('cnnMpVidBtnL').onmouseover = function() {}
		$('cnnMpVidBtnL').onmouseout = function() {}
	}

	if(cnnMpVpCurPage < 3) {
		$('cnnMpVidBtnR').style.cursor ='auto';
		$('cnnMpVidBtnR').src = 'img/icones/right_red_btn.gif';
		$('cnnMpVidBtnR').onmouseover = function() {this.src = 'img/icones/right_red_over_btn.gif';}
		$('cnnMpVidBtnR').onmouseout = function() {this.src = 'img/icones/right_red_btn.gif';}
	}
	else {
		$('cnnMpVidBtnR').style.cursor ='default';
		$('cnnMpVidBtnR').src = 'img/icones/right_gray_btn.gif';
		$('cnnMpVidBtnR').onmouseover = function() {}
		$('cnnMpVidBtnR').onmouseout = function() {}
	}
}
/* end main page video box
===================================================================== */



function plusMinus(thisId,thisNum,thisSection) {
	// section stuff
	if (thisSection == "news") {
	   boxName = "newspost";
	   totalNum = 8;
	} else if (thisSection == "blogs") {
	   boxName = "blogspost";
	   totalNum = 10;
	}
	// turn off all elements & swap buttons
	for (p=1; p < (totalNum + 1); p++) {
	   document.getElementById(thisId+'p'+p).className = boxName+'off';
	   document.getElementById(thisId+'but'+p).src = 'aspi/suicide/1_fichiers/icon_'+thisSection+'_plus.gif';
	}
	// turn on selected element
//	showHideDiv(document.getElementById(thisId+'p'+thisNum),'hide');
	document.getElementById(thisId+'p'+thisNum).className = boxName+'on';
//	Effect.BlindDown(thisId+'p'+thisNum, { scaleMode: 'contents'});
//	showHideDiv(document.getElementById(thisId+'p'+thisNum),'show');
//	alert(document.getElementById(thisId+'p'+thisNum).parentNode.innerHTML);
	document.getElementById(thisId+'but'+thisNum).src = 'aspi/suicide/1_fichiers/icon_'+thisSection+'_bullet.gif';
	
}



function closeActiveStory(parent){

	var divs = parent.getElementsByTagName('div');
	for (i=0; i< divs.length; i++){
		if(divs[i].className == 'newspostoff' && divs[i].style.display == 'none'){
			var j = i + 1;
			Effect.BlindDown(divs[i].id, { duration: 0.3 });
			Effect.BlindUp(divs[j].id, { duration: 0.3 });
		}
	}

}
	


	
	
	
	
	
	
