/*
 * Copyright (c) 2008 AKEEBO CORPORATION. All Rights Reserved.
 *
 * This software is the confidential and proprietary information ("Confidential Information") 
 * of AKEEBO CORPORATION ("AKEEBO CORP"). Any disclosure or use of such Confidential Information other 
 * than in accordance with the terms of the license under which it was received is strictly 
 * prohibited.
 *
 * AKEEBO CORP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF 
 * THE SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 * OR NON-INFRINGEMENT. AKEEBO CORP SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 */
 
/////////////////////////////////////////////////////////////////////
// alpha.js
// ahp 01/04/07  - changed alpha level to 80

var nMinFadeAmount = 5000;
var nMaxFadeAmount = 15000;
var nNumberFadeAmount = 7000;

// Change this to set transparency
// 100 is no transparency
// 0 is full transparency (that means only video and no graphics)
var nMaxAlpha = nAlpha = 83;

// decrement from maxAlpha to 0 using this decrement
var nAlphaDec = 5;

var oFadeStartTimer = null;
var oFadeOutTimer = null;

/////////////////////////////////////////////////////////////////////
// FADE STUFF

function increment() {
	setAlphaLevel(nMaxAlpha >= 100 ? 100 : ++nMaxAlpha);
}

function decrement() {
	setAlphaLevel(nMaxAlpha <= 0 ? 0 : --nMaxAlpha);
}

function doFade() {
	fadeReset(bExtInfoMode ? nMaxFadeAmount : nMinFadeAmount);
	
}

function fadeReset(nFadeAmount) {
	fadeStop();
	resetAlpha();
	oFadeStartTimer = window.setInterval ( 'fadeStart();', nFadeAmount );
}

function fadeStop() {
	document.getElementById("miniGuideImage").style.visibility = "hidden";
	if(oFadeStartTimer) { 
		window.clearTimeout(oFadeStartTimer); 
		oFadeStartTimer = null; 
	}
	if(oFadeOutTimer) { 
		window.clearTimeout(oFadeOutTimer); 
		oFadeOutTimer = null; 
	}
}

function resetAlpha() {
	setAlphaLevel(nMaxAlpha);
	bItsAllDark = false;
}

function fadeStart() {
	window.clearTimeout(oFadeStartTimer);
	oFadeStartTimer = null;
	oFadeOutTimer = window.setInterval('fadeOut();', 50); // this 25 millisec, not seconds
	
}

function fadeOut() {
	nAlpha -= nAlphaDec;
	nAlpha = nAlpha < 0 ? 0 : nAlpha;
	setAlphaLevel(nAlpha);
	if(nAlpha <= 0) {		 
		window.clearTimeout(oFadeOutTimer);
		oFadeOutTimer = null;
		nCurrentChannel = nSelectedChannel;
		nOldChannel = nSelectedChannel;
		fadeAll();	
		getAdInfo("all");
		document.getElementById("miniGuideImage").style.visibility = "visible";
		bItsAllDark = true;
		bExtInfoMode = false;
	}
}

// END alpha.js 
//////////////////////////////