
/* Script for changing text size using CSS 
==================================================================================*/

function increaseFontSize() {
    var i, a;
    for (i = 0; a = document.getElementsByTagName("link")[i]; i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 &&
            a.getAttribute("title")) {
            a.disabled = true;
            if (a.getAttribute("title") == 'LargeFont') {
                a.disabled = false;
            }
        }
    }
}


function decreaseFontSize() {
    var i, a;
    for (i = 0; a = document.getElementsByTagName("link")[i]; i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 &&
            a.getAttribute("title")) {
            a.disabled = true;
            if (a.getAttribute("title") == 'LargeFont') {
                a.disabled = true;
            }
        }
    }
}

/* Scripts used in the Knowledge videos
===================================================================================*/

var INSEADMpVpCurPage = 1;
var INSEADMpVpLock = false;


function INSEADMpVpBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * INSEADMpVpNext() and INSEADMpVpPrev()
 * are called from previous and next buttons
 */
function INSEADMpVpNext( lnk ) {
	INSEADMpVpBlur( lnk );
	if((INSEADMpVpCurPage < 3)&&(!INSEADMpVpLock)) {
		INSEADMpVpSlideLeft();
	}
}

function INSEADMpVpPrev( lnk ) {
	INSEADMpVpBlur( lnk );
	if((INSEADMpVpCurPage > 1)&&(!INSEADMpVpLock)) {
		INSEADMpVpSlideRight();
	}
}

/*
 * INSEADMpVpPage( intPage )
 * called from clicking on gray dot icon
 */
function INSEADMpVpPage( intPage, lnk ) {
	INSEADMpVpBlur( lnk );
	if((INSEADMpVpCurPage != intPage)&&(!INSEADMpVpLock)) {
		if(INSEADMpVpCurPage < intPage) {
			if((intPage - INSEADMpVpCurPage) > 1) {
				INSEADMpVpSlideDoubleLeft();
			}
			else {
				INSEADMpVpSlideLeft();
			}
		}
		else {
			if((INSEADMpVpCurPage - intPage) > 1) {
				INSEADMpVpSlideDoubleRight();
			}
			else {
				INSEADMpVpSlideRight();
			}
		}
	}
}

function INSEADLockMpVp( intDur ) {
	var INSEADLockDur = intDur * 100;
	INSEADMpVpLock = true;
	setTimeout(function() { INSEADMpVpLock = false; },INSEADLockDur);
}
function INSEADMpVpSlideLeft() {
	INSEADLockMpVp(3);
	new Effect.MoveBy( 'INSEADMpVidCtnt0', -240, 0 , {duration: 0.3} );
	new Effect.MoveBy( 'INSEADMpVidCtnt1', -240, 0, {duration: 0.3} );
	new Effect.MoveBy( 'INSEADMpVidCtnt2', -240, 0 , {duration: 0.3} );
	INSEADMpVpCurPage++;
	INSEADMpVpMoveDot();
	INSEADMpVpUpdateBtns();
}

function INSEADMpVpSlideDoubleLeft() {
	INSEADLockMpVp(6);
	new Effect.MoveBy( 'INSEADMpVidCtnt0', -480, 0 , {duration: 0.6} );
	new Effect.MoveBy( 'INSEADMpVidCtnt1', -480, 0 , {duration: 0.6} );
	new Effect.MoveBy( 'INSEADMpVidCtnt2', -480, 0 , {duration: 0.6} );
	INSEADMpVpCurPage++;
	INSEADMpVpCurPage++;
	INSEADMpVpMoveDot();
	INSEADMpVpUpdateBtns();
}

function INSEADMpVpSlideRight() {
	INSEADLockMpVp(3);
	new Effect.MoveBy( 'INSEADMpVidCtnt0', 240, 0 , {duration: 0.3} );
	new Effect.MoveBy( 'INSEADMpVidCtnt1', 240, 0, {duration: 0.3} );
	new Effect.MoveBy( 'INSEADMpVidCtnt2', 240, 0, {duration: 0.3} );
	INSEADMpVpCurPage--;
	INSEADMpVpMoveDot();
	INSEADMpVpUpdateBtns();
}

function INSEADMpVpSlideDoubleRight() {
	INSEADLockMpVp(6);
	new Effect.MoveBy( 'INSEADMpVidCtnt0', 480, 0 , {duration: 0.6} );
	new Effect.MoveBy( 'INSEADMpVidCtnt1', 480, 0 , {duration: 0.6} );
	new Effect.MoveBy( 'INSEADMpVidCtnt2', 240, 0, {duration: 0.6} );
	INSEADMpVpCurPage--;
	INSEADMpVpCurPage--;
	INSEADMpVpMoveDot();
	INSEADMpVpUpdateBtns();
}

function INSEADMpDotMouseOver( id ) {
	$(id).src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';
}

// image change functions
function INSEADMpVpMoveDot() {
	for(i=1;i<4;i++) {
		$('INSEADMpVidDot'+i).src = 'images/gray_status.gif';
		$('INSEADMpVidDot'+i).onmouseover = function() {this.src = 'images/gray_active_status.gif';}
		$('INSEADMpVidDot'+i).onmouseout = function() {this.src = 'images/gray_status.gif';}
	}
	$('INSEADMpVidDot'+INSEADMpVpCurPage).src = 'images/gray_active_status.gif';
	$('INSEADMpVidDot'+INSEADMpVpCurPage).onmouseover = function() {}
	$('INSEADMpVidDot'+INSEADMpVpCurPage).onmouseout = function() {}
}
function INSEADMpVpUpdateBtns() {
	if(INSEADMpVpCurPage > 1) {
		$('INSEADMpVidBtnL').style.cursor ='auto';
		$('INSEADMpVidBtnL').src = 'images/left_red_btn.gif';
		$('INSEADMpVidBtnL').onmouseover = function() { this.src='images/left_red_over_btn.gif'; }
		$('INSEADMpVidBtnL').onmouseout = function() { this.src='images/left_red_btn.gif'; }
	}
	else {
		$('INSEADMpVidBtnL').style.cursor ='default';
		$('INSEADMpVidBtnL').src = 'images/left_gray_btn.gif';
		$('INSEADMpVidBtnL').onmouseover = function() {}
		$('INSEADMpVidBtnL').onmouseout = function() {}
	}

	if(INSEADMpVpCurPage < 3) {
		$('INSEADMpVidBtnR').style.cursor ='auto';
		$('INSEADMpVidBtnR').src = 'images/right_red_btn.gif';
		$('INSEADMpVidBtnR').onmouseover = function() {this.src = 'images/right_red_over_btn.gif';}
		$('INSEADMpVidBtnR').onmouseout = function() {this.src = 'images/right_red_btn.gif';}
	}
	else {
		$('INSEADMpVidBtnR').style.cursor ='default';
		$('INSEADMpVidBtnR').src = 'images/right_gray_btn.gif';
		$('INSEADMpVidBtnR').onmouseover = function() {}
		$('INSEADMpVidBtnR').onmouseout = function() {}
	}
}
/* end main page video box
===================================================================== */


function showcart(ct)
{var win=window.open('studynetlink.cfm?action=ATC&ct=' + ct,'studynetwin','height=500, width=600, scrollbars=yes, toolbar=yes, menubar=no');if (win.focus) win.focus();}

/* <!---***---> for more than one case studies (for addtocart function)*/
function showcart2(research_id,num_doc){
	list = ""; strcount = 0;
	for(i=1;i<=num_doc;i++){
		if(document.getElementById("getdoc_"+i).checked){
			list += document.getElementById("getdoc_"+i).value+",";	
		}
	}	
	strcount = list.length;
	if (list != "") {
		list = list.substr(0,(strcount-1));
		showcart(list);
	}
	else
		{document.location = "?ct="+research_id;}
}
