
//function opacity(id, opacStart, opacEnd, millisec) {
//	//speed for each frame
//	var speed = Math.round(millisec / 100);
//	var timer = 0;
//
//	//determine the direction for the blending, if start and end are the same nothing happens
//	if(opacStart > opacEnd) {
//		for(i = opacStart; i >= opacEnd; i--) {
//			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
//			timer++;
//		}
//	} else if(opacStart < opacEnd) {
//		for(i = opacStart; i <= opacEnd; i++)
//			{
//			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
//			timer++;
//		}
//	}
//}

var currentNews = 0;

function newsClick() {
//	if (currentNews == 1)
//		$('dynamicLoader').src='/home/press.php?render=launchupdate';
//	else
		$('dynamicLoader').src='/home/press.php?render=pressrel';
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	if ($(id)) {
		var object = $(id).style; 
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
//		$(id).className = 'newsText';
	}
}


function blendNewText(textid, newText, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	changeOpac(0, textid);
	
	if ($(textid)) {
		$(textid).innerHTML = newText;

		for(i = 0; i <= 100; i++) {
			setTimeout("changeOpac(" + i + ",'" + textid + "')",(timer * speed));
			timer++;
		}
	}
}

var intervalID;

function fadeNews(){
	if (intervalID) 
		clearTimeout(intervalID);
	intervalID = setInterval(flashText, 10000);   	
}

var arrayNews = [	
	'<strong>07.14.10</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>XStreamHD</i> to Offer the Latest Full HD Movies from Lionsgate',
    '<strong>06.29.10</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>XStreamHD</i> Signs Satellite Services Agreement with EchoStar',
	'<strong>04.16.10</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>XStreamHD</i> Selected to Showcase its Whole-Home HD Entertainment Solution at CES on the Hill',
	'<strong>04.15.10</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>XStreamHD</i> Fast Start to be Bundled with all BenQ W6000 Projectors'
]; 

function flashText(){	
	if ($('newsElement')) {
		if(currentNews > arrayNews.length-2)
			currentNews=0;
		else
			currentNews+=1;
		blendNewText('newsElement', arrayNews[currentNews], '1000');		
	}
	else 
		clearTimeout(intervalID);
}
