var delayNews = 10000;
var arrayNews = new Array();
var pointNews = 0
var stopNews	= true; //false;

var delayHigh = 15000;
var arrayHigh = new Array();
var pointHigh = 0;
var stopHigh	= true; //false;

var imagelist = new Array("intel.gif", "lge.gif", "panasonic.gif", "qualcomm.gif", "logo.gif", "nokia.gif", "ti.gif", "viasat.gif");
var imageindx = 2;
var imagepath = "/webdir/images/";
var imagedelay= 8000;

function changeImage() {
	var image1 = document.getElementById("logoimage1");
	var image2 = document.getElementById("logoimage2");
	
	if (imageindx >= imagelist.length) imageindx = 0;
	image2.src = image1.src;
	image1.src = imagepath + imagelist[imageindx++];
	
	setTimeout('changeImage()', imagedelay);
}

function stopHighLight() {
	stopHigh = true;
}

function startHighLight() {
	stopHigh = true; //false;
}

function feedHighLight() {
	if (!stopHigh) {
		var xmlHttp = GetXmlHttpObject();
		var rssText = "";
	
		if (arrayHigh.length > 0) {
			if (document.getElementById("highLight") != null) {
				document.getElementById("highLight").innerHTML = arrayHigh[pointHigh++];
				if (pointHigh == arrayHigh.length) pointHigh = 0;			
			}
		} else { 
			if (xmlHttp != null) {
				if (document.getElementById("highLight") != null) {
					xmlHttp.onreadystatechange = function() {
  					if(xmlHttp.readyState == 4) {
							rssText = xmlHttp.responseText;
							arrayHigh = rssText.split("<\|>");
							document.getElementById("highLight").innerHTML = arrayHigh[0];
						}
					}
					xmlHttp.open("GET","showHLightRSS.php",true);
    			xmlHttp.send(null);			
  			}      
			}
		}
	}
 	setTimeout('feedHighLight()', delayHigh);
} 


function stopECENews() {
	stopNews = true;
}

function startECENews() {
	stopNews = true; //false;
}

function feedNews() {
	if (!stopNews) {
		var xmlHttp = GetXmlHttpObject();
		var rssText = "";

		if (arrayNews.length > 0) {
			if (document.getElementById("newsid") != null) {
				document.getElementById("newsid").innerHTML = arrayNews[pointNews++];
				if (pointNews == arrayNews.length) pointNews = 0;
			}
		} else {
			if (xmlHttp != null) {
				if (document.getElementById("newsid") != null) {
					xmlHttp.onreadystatechange = function() {
  					if(xmlHttp.readyState == 4) {
							rssText =  xmlHttp.responseText;
							arrayNews = rssText.split("<\|>");		
							document.getElementById("newsid").innerHTML = arrayNews[0];
						}
					}
					xmlHttp.open("GET","showNewsRSS.php",true);
    			xmlHttp.send(null);			
  			}      
			}
		}
	}
 	setTimeout('feedNews()', delayNews);
} 


function GetXmlHttpObject() {
	var xmlHttp = null;
	try {
  	// Firefox, Opera 8.0+, Safari
  	xmlHttp=new XMLHttpRequest();
  } catch (e) {  	
  	try {
			// Internet Explorer
    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
	return xmlHttp;
}


