Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/newsflash/
Upload File :
Current File : /var/www/html/mmishra/indem/newsflash/rss.js

var rssBoxTxt_readMore = '';
var rssBoxOpenLinksInNewWindow = true;
	
	
var rssBoxAjaxObjects = new Array();
	
function changeSlide(boxId,secondBetweenSlides,slideIndex)
{
	var el = document.getElementById(boxId);
	var divs = el.getElementsByTagName('DIV');
	if(slideIndex>0){
		divs[slideIndex-1].style.display='none';
	}else{
		divs[divs.length-1].style.display='none';	
	}	
	divs[slideIndex].style.display='block';
	slideIndex++;
	if(slideIndex>=divs.length)slideIndex = 0;
	setTimeout('changeSlide("' + boxId + '",' + secondBetweenSlides + ',' + slideIndex + ')',secondBetweenSlides*1000);
		
}
	
function openUrlInNewWindow()
{
	var rssBoxWin = window.open(this.href);
	return false;
}

function showAjaxContent(ajaxIndex,boxId,secondBetweenSlides)
{
		
	var rssContent = rssBoxAjaxObjects[ajaxIndex].response;
	tokens = rssContent.split(/\n\n/g);
	var destinationObj = document.getElementById(boxId);
	var headerTokens = tokens[0].split(/\n/g);
	if(headerTokens[0]=='0'){
		headerTokens[1] = '';
		headerTokens[0] = 'Invalid source';
	}
		
		
	for(var no=1;no<tokens.length;no++){	// Looping through RSS items
		var string = '';
		var itemTokens = tokens[no].split(/##/g);		
		var div = document.createElement('DIV');
		if(no>1)div.style.display='none';	
		destinationObj.appendChild(div);
		
		// Adding date
		//var date = document.createElement('P');
		//date.className='rssBoxDate';
		//date.innerHTML = itemTokens[1];
		//div.appendChild(date);
		
		// Adding heading
		var heading = document.createElement('P');
		heading.className = 'rssBoxHeading';
		heading.innerHTML = itemTokens[0];
		div.appendChild(heading);
		
		// Adding description
		var description = document.createElement('P');
		description.className='rssBoxDescription';
		description.innerHTML = itemTokens[2];
		div.appendChild(description);
		
		// Adding link
		var link = document.createElement('A');
		link.className = 'rssBoxLink';
		link.innerHTML = rssBoxTxt_readMore;
		link.href = itemTokens[3];
		if(rssBoxOpenLinksInNewWindow){
			link.onclick = openUrlInNewWindow;
		}
		div.appendChild(link);
		
	}
		
	setTimeout('changeSlide("' + boxId + '",' + secondBetweenSlides + ',1)',secondBetweenSlides*1000);
	
		

				
}
	
function insertAjaxContent(destinationId,url,maxItems,secondBetweenSlides)
{
	var ajaxIndex = rssBoxAjaxObjects.length;
	rssBoxAjaxObjects[ajaxIndex] = new sack();
	rssBoxAjaxObjects[ajaxIndex].requestFile = 'readRSS.php?rssURL=' + url + '&maxRssItems=' + maxItems;	// Specifying which file to get
	rssBoxAjaxObjects[ajaxIndex].onCompletion = function(){ showAjaxContent(ajaxIndex,destinationId,secondBetweenSlides); };	// Specify function that will be executed after file has been found
	rssBoxAjaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	
}
	
function initRssBoxScript(mmAlert)
{
	//insertAjaxContent('rssBox','rss.xml',7,7); 	// first integer->number of news to show, second integer->time delay
	insertAjaxContent('newsflash','rss.xml',7,7); 	// first integer->number of news to show, second integer->time delay
		
        if (mmAlert) {
		window.open(mmAlert,'mmAlert','toolbar=no,statusbar=no,location=no,scrollbars=no,resizable=no,directories=no,left=0,top=0,width=475,height=200');
	}

}
var mmAlert = '';//'http://www.iiita.ac.in/alert.htm'; //url of alert page
window.onload = initRssBoxScript(mmAlert);