// JavaScript Document
function loadFeed(type, pagenumber, perpage, size) {
	var url;
	var HTMLreplace = ""
	var PrevLink = "";
	var NextLink = "";
	var titleLen;
	var linkid = type+"page";
	var contentid = type+"center";
	var wrapperid = type+"wrapper";
	var image = document.createElement('img');
	var fin1 = 0;
	var fin2 = 0;
	var namewidth;
	var nameLen;
	//image.setAttribute('src', '/images/grey-loader.gif');
	image.setAttribute('src', '/images/transparent-loader.gif');
	image.setAttribute('id', 'loaderimg');
	
	if(size == "large") { 
		var leftm = "300px";
		var topm = "147px";
		var bottomm = "147px";
		titleLen = 83;
		
		namewidth = 440;
		nameLen = 60;
		
		sourceLen = 20;
	} 
	else {
		var leftm = "200px";
		var topm = "120px";
		var bottomm = "100px";
		
		/* This was initially 55 but 'truncate' doesn't take words into account and everything here shows up too short if i use 55*/
		titleLen = 50;
		
		namewidth = 210;
		nameLen = 30;
		sourceLen = 15;
		size == "small";
	}
	
	url = "/news_item/news_feed/"+type+"/"+pagenumber+"/"+perpage;

	new Ajax.Request(url, 
		{
		method: 'get', onCreate:function(){
			$(wrapperid).style.display = "none";
			$(contentid).appendChild(image);
			$("loaderimg").style.marginLeft = leftm;
			$("loaderimg").style.marginTop = topm;
			$("loaderimg").style.marginBottom = bottomm;
			
			$(linkid).innerHTML = '<a class="prev" style="text-decoration:none;"><img src="/css/images/newbutton-darkgrey-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a><a class="next" style="text-decoration:none;"> <img src="/css/images/newbutton-darkgrey-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a> <a href="/manage'+type+'/"><img src="/css/images/newbutton-darkgrey-manage.gif" width="70" height="20" alt="Manage" border="0" /></a>';
			},
		onSuccess: function(transport) 
			{
			responseJSON = transport.responseText.evalJSON();
			
			//  predefine in case
			var rating_bg;
			var the_current_rating;
			var current_rating_rounded;
			var other_ratings;
			
			for(i = 0; i < responseJSON.jsonHeadlines.length; i++) {
				
				//  get the rating
				the_current_rating = parseFloat(responseJSON.jsonHeadlines[i].current_rating);
				
				//  determine the required background for the rating
			    if(the_current_rating == 0) {
					rating_bg = ' grey';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowgreen';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) > 50)) {
					rating_bg = ' highgreen';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowred';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) > 50)) { 
					rating_bg = ' highred';
				}
				
				else {
					rating_bg = ' grey';	
				}
				
				//  if there aren't enough ratings, show the default
				if(responseJSON.jsonHeadlines[i].num_ratings < 3) {
					rating_bg = ' grey';
					current_rating_rounded = 'N/A';
				}
				else {					
					//  round the rating to no decimals for purposes of display
					current_rating_rounded = the_current_rating.toFixed(0);
					current_rating_rounded = current_rating_rounded+'% ';
				}	
				
				//  if necessary, change the background colour of the rating graphic
				if(i % 2 == 1) {
					rating_bg = rating_bg+'light';
				}
				
				//  if there are ratings, we want to have an example id so that we can link to them all
				if(responseJSON.jsonHeadlines[i].example_rating) {
					other_ratings = '<a href="/related_ratings/view_rating/'+responseJSON.jsonHeadlines[i].example_rating+'">Ratings</a>';
				}
				else {
					other_ratings = 'Ratings';
				}
				
				var date = responseJSON.jsonHeadlines[i].dateadded;
				
				HTMLreplace = HTMLreplace+'<div class="row';
				if(i % 2 == 0){
					HTMLreplace=HTMLreplace+' trsp';
				}
				HTMLreplace=HTMLreplace+'">';
				HTMLreplace=HTMLreplace+'<div class="cl"> </div>';
				
				HTMLreplace=HTMLreplace+'<div class="news_information">';
                HTMLreplace=HTMLreplace+'<strong style="width: '+namewidth+'px"><a href="/pubco/profile/'+responseJSON.jsonHeadlines[i].company_name+'">'+responseJSON.jsonHeadlines[i].longname.truncate(nameLen,'')+'</a></strong>';
                HTMLreplace=HTMLreplace+'<span style="font-size: 11px; width: 100px; margin-left:5px;">'+responseJSON.jsonHeadlines[i].dateadded+' </span>';
				//HTMLreplace=HTMLreplace+'<span style="font-size: 11px; font-weight: bold;">&nbsp;&nbsp;'+responseJSON.jsonHeadlines[i].source.truncate(sourceLen, '')+'</span>';
				if(responseJSON.jsonHeadlines[i].isupdate != 1){
               		HTMLreplace=HTMLreplace+'<span class="leftpart"><a href="/news_item/retrieve/'+responseJSON.jsonHeadlines[i].story_id+'/'+responseJSON.jsonHeadlines[i].company_name+'">'+unescape(responseJSON.jsonHeadlines[i].headline.truncate(titleLen))+'</a></span>';
				}
				else {
					HTMLreplace=HTMLreplace+'<span class="leftpart">'+responseJSON.jsonHeadlines[i].headline+'</span>';
				}
                HTMLreplace=HTMLreplace+'</div>';
				
				HTMLreplace=HTMLreplace+'<div class="rating_information">';
				if(responseJSON.jsonHeadlines[i].isupdate != 1){
                	HTMLreplace=HTMLreplace+'<div class="news_article_rating'+rating_bg+'">';
					HTMLreplace=HTMLreplace+'<div class="current_rating_percentage'+rating_bg+'">';
					HTMLreplace=HTMLreplace+current_rating_rounded;
                	HTMLreplace=HTMLreplace+'</div>';
                	HTMLreplace=HTMLreplace+'<div class="number_ratings">';
                	HTMLreplace=HTMLreplace+'<b>'+responseJSON.jsonHeadlines[i].num_ratings+'</b><br/>'+other_ratings;
               		HTMLreplace=HTMLreplace+'</div>';
                	HTMLreplace=HTMLreplace+'</div>';
				}
                HTMLreplace=HTMLreplace+'</div>';
				
				HTMLreplace = HTMLreplace+'<div class="cl"> </div>';
				HTMLreplace = HTMLreplace+'</div>';
				
				}   
				$(wrapperid).innerHTML=HTMLreplace;
				fin1 = 1;
				if(fin2 == 1){
					$(wrapperid).style.display = "block";
					$(contentid).removeChild(image);
				}
			}
		}
		);
		var url2 = "/news_item/get_total_headlines/"+type;
		new Ajax.Request(url2, 
		{
		method: 'get', onCreate:function(){
			},
		onSuccess: function(transport) 
			{
			response = transport.responseText;
			var prevpage = pagenumber - 1;
			var nextpage = pagenumber + 1;
			if(prevpage != 0) {
				//  newer/enabled case
				PrevLink='<a onclick="loadFeed(\''+type+'\','+prevpage+','+perpage+',\''+size+'\' )" class="prev"><img src="/css/images/newbutton-darkgrey-newer.gif" width="48" height="20" alt="Newer" border="0"/></a> ';
			}
			else {
				//  newer/disabled case
				PrevLink='<a class="prev"><img src="/css/images/newbutton-darkgrey-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a>';
			}
			if(response > (nextpage*perpage)-perpage) {
					//  older/enabled case
				NextLink='<a onclick="loadFeed(\''+type+'\','+nextpage+','+perpage+',\''+size+'\' )" class="next"><img src="/css/images/newbutton-darkgrey-older.gif" width="48" height="20" alt="Older" border="0"/></a>';
			}
			else {
				//  older/disabled case
				NextLink='<a class="next"><img src="/css/images/newbutton-darkgrey-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a>';
			}
			$(linkid).innerHTML=PrevLink+NextLink+' <a href="/manage'+type+'/"><img src="/css/images/newbutton-darkgrey-manage.gif" width="70" height="20" alt="Manage" border="0" /></a>';
			fin2 = 1;
				if(fin1 == 1){
					$(wrapperid).style.display="block";
					$(contentid).removeChild(image);
				}
			}
		}
		);

	}
	
//  this function is a variation of the above strictly because the recommended feed is now fueled by the 
//  search index
function loadRecommendedFeed(pagenumber, perpage, size) {
	var url;
	var HTMLreplace = ""
	var PrevLink = "";
	var NextLink = "";
	var titleLen;
	var linkid = "recommendedpage";
	var contentid = "recommendedcenter";
	var wrapperid = "recommendedwrapper";
	var image = document.createElement('img');
	var fin1 = 0;
	var fin2 = 0;
	var namewidth;
	var nameLen;
	//image.setAttribute('src', '/images/grey-loader.gif');
	image.setAttribute('src', '/images/transparent-loader.gif');
	image.setAttribute('id', 'loaderimg');
	
	if(size == "large") { 
		var leftm = "300px";
		var topm = "147px";
		var bottomm = "147px";
		titleLen = 83;
		
		namewidth = 430;
		nameLen = 60;
		
		sourceLen = 20;
	} 
	else {
		var leftm = "200px";
		var topm = "120px";
		var bottomm = "100px";
		
		/* This was initially 55 but 'truncate' doesn't take words into account and everything here shows up too short if i use 55*/
		titleLen = 50;
		
		namewidth = 200;
		nameLen = 30;
		sourceLen = 15;
		size == "small";
	}
	
	url = "/news_item/news_feed/recommended/"+pagenumber+"/"+perpage;

	new Ajax.Request(url, 
		{
		method: 'get', onCreate:function(){
			$(wrapperid).style.display = "none";
			$(contentid).appendChild(image);
			$("loaderimg").style.marginLeft = leftm;
			$("loaderimg").style.marginTop = topm;
			$("loaderimg").style.marginBottom = bottomm;
			
			$(linkid).innerHTML = '<a class="prev" style="text-decoration:none;"><img src="/css/images/newbutton-darkgrey-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a><a class="next" style="text-decoration:none;"> <img src="/css/images/newbutton-darkgrey-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a> <a href="/managerecommended/"><img src="/css/images/newbutton-darkgrey-manage.gif" width="70" height="20" alt="Manage" border="0" /></a>';
			},
		onSuccess: function(transport) 
			{
			responseJSON = transport.responseText.evalJSON();
			
			// the total number of news records found
			var total_num_found = '';
			total_num_found = responseJSON.jsonTotalFound;
			
			//  predefine in case
			var rating_bg;
			var the_current_rating;
			var current_rating_rounded;
			var other_ratings;
			
			for(i = 0; i < responseJSON.jsonHeadlines.length; i++) {
				//  get the rating
				the_current_rating = parseFloat(responseJSON.jsonHeadlines[i].current_rating);
				
				//  determine the required background for the rating
			    if(the_current_rating == 0) {
					rating_bg = ' grey';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowgreen';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) > 50)) {
					rating_bg = ' highgreen';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowred';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) > 50)) { 
					rating_bg = ' highred';
				}
				
				else {
					rating_bg = ' grey';	
				}
				
				//  if there aren't enough ratings, show the default
				if(responseJSON.jsonHeadlines[i].num_ratings < 3) {
					rating_bg = ' grey';
					current_rating_rounded = 'N/A';
				}
				else {					
					//  round the rating to no decimals for purposes of display
					current_rating_rounded = the_current_rating.toFixed(0);
					current_rating_rounded = current_rating_rounded+'% ';
				}	
				
				//  if necessary, change the background colour of the rating graphic
				if(i % 2 == 1) {
					rating_bg = rating_bg+'light';
				}
				
				//  if there are ratings, we want to have an example id so that we can link to them all
				if(responseJSON.jsonHeadlines[i].example_rating) {
					other_ratings = '<a href="/related_ratings/view_rating/'+responseJSON.jsonHeadlines[i].example_rating+'">Ratings</a>';
				}
				else {
					other_ratings = 'Ratings';
				}
				
				var date = responseJSON.jsonHeadlines[i].dateadded;
				
				HTMLreplace = HTMLreplace+'<div class="row';
				if(i % 2 == 0){
					HTMLreplace=HTMLreplace+' trsp';
				}
				HTMLreplace=HTMLreplace+'">';
				HTMLreplace=HTMLreplace+'<div class="cl"> </div>';
				
				HTMLreplace=HTMLreplace+'<div class="news_information">';
                HTMLreplace=HTMLreplace+'<strong style="width: '+namewidth+'px"><a href="/pubco/profile/'+responseJSON.jsonHeadlines[i].company_name+'">'+responseJSON.jsonHeadlines[i].longname.truncate(nameLen,'')+'</a></strong>';
                HTMLreplace=HTMLreplace+'<span style="font-size: 11px; width: 110px; margin-left:5px;">'+responseJSON.jsonHeadlines[i].dateadded+' </span>';
				//HTMLreplace=HTMLreplace+'<span style="font-size: 11px; font-weight: bold;">&nbsp;&nbsp;'+responseJSON.jsonHeadlines[i].source.truncate(sourceLen, '')+'</span>';
				
				if(responseJSON.jsonHeadlines[i].isupdate != 1){
					
               		HTMLreplace=HTMLreplace+'<span class="leftpart"><a href="/news_item/retrieve/'+responseJSON.jsonHeadlines[i].story_id+'/'+responseJSON.jsonHeadlines[i].company_name+'">'+unescape(responseJSON.jsonHeadlines[i].data.truncate(titleLen))+'</a></span>';
				}
				else {
					HTMLreplace=HTMLreplace+'<span class="leftpart">'+responseJSON.jsonHeadlines[i].data+'</span>';
				}
                HTMLreplace=HTMLreplace+'</div>';
				
				HTMLreplace=HTMLreplace+'<div class="rating_information">';
				if(responseJSON.jsonHeadlines[i].isupdate != 1){
                	HTMLreplace=HTMLreplace+'<div class="news_article_rating'+rating_bg+'">';
					HTMLreplace=HTMLreplace+'<div class="current_rating_percentage'+rating_bg+'">';
					HTMLreplace=HTMLreplace+current_rating_rounded;
                	HTMLreplace=HTMLreplace+'</div>';
                	HTMLreplace=HTMLreplace+'<div class="number_ratings">';
                	HTMLreplace=HTMLreplace+'<b>'+responseJSON.jsonHeadlines[i].num_ratings+'</b><br/>'+other_ratings;
               		HTMLreplace=HTMLreplace+'</div>';
                	HTMLreplace=HTMLreplace+'</div>';
				}
                HTMLreplace=HTMLreplace+'</div>';
				
				HTMLreplace = HTMLreplace+'<div class="cl"> </div>';
				HTMLreplace = HTMLreplace+'</div>';
			}
			
			var prevpage = pagenumber - 1;
			var nextpage = pagenumber + 1;
			if(prevpage != 0) {
				//  newer/enabled case
				PrevLink='<a onclick="loadRecommendedFeed('+prevpage+','+perpage+',\''+size+'\' )" class="prev"><img src="/css/images/newbutton-darkgrey-newer.gif" width="48" height="20" alt="Newer" border="0"/></a> ';
			}
			else {
				//  newer/disabled case
				PrevLink='<a class="prev"><img src="/css/images/newbutton-darkgrey-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a>';
			}
			if(total_num_found > (nextpage*perpage)-perpage) {
					//  older/enabled case
				NextLink='<a onclick="loadRecommendedFeed('+nextpage+','+perpage+',\''+size+'\' )" class="next"><img src="/css/images/newbutton-darkgrey-older.gif" width="48" height="20" alt="Older" border="0"/></a>';
			}
			else {
				//  older/disabled case
				NextLink='<a class="next"><img src="/css/images/newbutton-darkgrey-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a>';
			}
			$(linkid).innerHTML=PrevLink+NextLink+' <a href="/managerecommended/"><img src="/css/images/newbutton-darkgrey-manage.gif" width="70" height="20" alt="Manage" border="0" /></a>';
			
			$(wrapperid).innerHTML=HTMLreplace;
			$(wrapperid).style.display = "block";
			$(contentid).removeChild(image);
		}
	}
	);
}	
	
function loadCompFeed(company_id, pagenumber, size, color) {
	var url;
	var HTMLreplace = ""
	var PrevLink = "";
	var NextLink = "";
	var titleLen;
	var image = document.createElement('img');
	var fin1 = 0;
	var fin2 = 0;
	var namewidth;
	
	//image.setAttribute('src', '/images/grey-loader.gif');
	image.setAttribute('src', '/images/transparent-loader.gif');
	image.setAttribute('id', 'loaderimg');
	
	if(size == "large") { 
		var leftm = "300px";
		namewidth = 440;
		nameLen = 60;
		
		titleLen = 83;
		/* This was initially 75 but 'truncate' doesn't take words into account and everything here shows up too short if i use 75*/
	}
	else {
		var leftm = "200px";
		namewidth = 200;
		nameLen = 30;
		
		/* This was initially 40 but 'truncate' doesn't take words into account and everything here shows up too short if i use 40*/
		titleLen = 48;
		size = "small";
	}
	
	if((color != "blue") && (color != "darkgrey")){
		color = "grey";
	}
	
	url = "/news_item/comp_feed/"+company_id+"/"+pagenumber;

	new Ajax.Request(url, 
		{
		method: 'get', onCreate:function(){
			
			$("corplatestnewswrapper").style.display = "none";
			$("corplatestnews").appendChild(image);
			$("loaderimg").style.marginLeft = leftm;
			$("loaderimg").style.marginTop = "147px";
			$("loaderimg").style.marginBottom = "147px";
			//$("corplatestnews").innerHTML='<img src="/images/grey-loader.gif" style="margin: 147px 200px;">';
			$("corplatestnewslink").innerHTML = '<a class="prev" style="text-decoration:none;"><img src="/css/images/newbutton-'+color+'-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a><a class="next" style="text-decoration:none;"> <img src="/css/images/newbutton-'+color+'-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a>';

			},
		onSuccess: function(transport) 
			{
			responseJSON = transport.responseText.evalJSON();
			
			//  predefine in case
			var rating_bg;
			var the_current_rating;
			var current_rating_rounded;
			var other_ratings;
			
			for(i = 0; i < responseJSON.jsonCompHeadlines.length; i++) {
				
				//  get the rating
				the_current_rating = parseFloat(responseJSON.jsonCompHeadlines[i].current_rating);
				
				//  determine the required background for the rating
			    if(the_current_rating == 0) {
					rating_bg = ' grey';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowgreen';
				}
				
				else if ((the_current_rating > 0) && (Math.abs(the_current_rating) > 50)) {
					rating_bg = ' highgreen';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) <= 50)) {
					rating_bg = ' lowred';
				}
				
				else if ((the_current_rating < 0) && (Math.abs(the_current_rating) > 50)) { 
					rating_bg = ' highred';
				}
				
				else {
					rating_bg = ' grey';	
				}
				
				//  if there aren't enough ratings, show the default
				if(responseJSON.jsonCompHeadlines[i].num_ratings < 3) {
					rating_bg = ' grey';
					current_rating_rounded = 'N/A';
				}
				else {					
					//  round the rating to no decimals for purposes of display
					current_rating_rounded = the_current_rating.toFixed(0);
					current_rating_rounded = current_rating_rounded+'% ';
				}					
				
				//  if necessary, change the background colour of the rating graphic
				if(i % 2 == 1) {
					rating_bg = rating_bg+'light';
				}
				
				//  if there are ratings, we want to have an example id so that we can link to them all
				if(responseJSON.jsonCompHeadlines[i].example_rating) {
					other_ratings = '<a href="/related_ratings/view_rating/'+responseJSON.jsonCompHeadlines[i].example_rating+'">Ratings</a>';
				}
				else {
					other_ratings = 'Ratings';
				}
					
				HTMLreplace = HTMLreplace+'<div class="row';
				if(i % 2 == 0){
					HTMLreplace=HTMLreplace+' trsp';
				}
				HTMLreplace=HTMLreplace+'">';
				HTMLreplace=HTMLreplace+'<div class="cl"> </div>';
				
				HTMLreplace=HTMLreplace+'<div class="news_information">';	
                HTMLreplace=HTMLreplace+'<strong style="width:'+namewidth+'px;">'+responseJSON.jsonCompHeadlines[i].longname.truncate(nameLen, '')+'</strong>';
				
                HTMLreplace=HTMLreplace+'<span style="font-size: 11px; width: 100px;">'+responseJSON.jsonCompHeadlines[i].dateadded+'</span>';
				//HTMLreplace=HTMLreplace+'<span style="font-size: 11px; font-weight: bold;">&nbsp;&nbsp;'+responseJSON.jsonCompHeadlines[i].source+'</span>';
                HTMLreplace=HTMLreplace+'<span class="leftpart"><a href="/news_item/retrieve/'+responseJSON.jsonCompHeadlines[i].story_id+'/'+responseJSON.jsonCompHeadlines[i].company_name+'">'+unescape(responseJSON.jsonCompHeadlines[i].headline.truncate(titleLen))+'</a></span>';
                HTMLreplace=HTMLreplace+'</div>';
				HTMLreplace=HTMLreplace+'<div class="rating_information">';
                HTMLreplace=HTMLreplace+'<div class="news_article_rating'+rating_bg+'">';
                HTMLreplace=HTMLreplace+'<div class="current_rating_percentage'+rating_bg+'">';
				HTMLreplace=HTMLreplace+current_rating_rounded;
                HTMLreplace=HTMLreplace+'</div>';
                HTMLreplace=HTMLreplace+'<div class="number_ratings">';
                HTMLreplace=HTMLreplace+'<b>'+responseJSON.jsonCompHeadlines[i].num_ratings+'</b><br/>'+other_ratings;
                HTMLreplace=HTMLreplace+'</div>';
                HTMLreplace=HTMLreplace+'</div>';
                HTMLreplace=HTMLreplace+'</div>';
				
				HTMLreplace = HTMLreplace+'<div class="cl"> </div>';
				HTMLreplace = HTMLreplace+'</div>';
				
				}  
				$("corplatestnewswrapper").innerHTML=HTMLreplace;
				fin1=1;
				if(fin2==1){
					$("corplatestnewswrapper").style.display="block";
					$("corplatestnews").removeChild(image);
					}
			}
		}
		);
		var url2 = "/news_item/get_total_compheadlines/"+company_id;
		new Ajax.Request(url2, 
		{
		method: 'get', onCreate:function(){
			},
		onSuccess: function(transport) 
			{
			response = transport.responseText;
			var prevpage = pagenumber-1;
			var nextpage = pagenumber+1;
			if(prevpage != 0) {
				/* READDRESS WHEN WE LOOK AT THE INVESTOR SIDE OF THINGS AGAIN
				PrevLink='<a onclick="loadCompFeed('+company_id+','+prevpage+',\''+size+'\' )" class="prev"><strong>Prev';
				if(size!="large"){
					PrevLink=PrevLink+ 'Feed Set';
					}
				PrevLink=PrevLink+'</strong></a> ';*/
				
				PrevLink='<a onclick="loadCompFeed('+company_id+','+prevpage+',\''+size+'\',\''+color+'\' )" class="prev" style="text-decoration:none;"> <img src="/css/images/newbutton-'+color+'-newer.gif" width="48" height="20" alt="Newer" border="0"/></a>';
				
			}
			else {
				/* READDRESS WHEN WE LOOK AT THE INVESTOR SIDE OF THINGS AGAIN
				PrevLink='<a class="prev" style="color: #DDD;"><strong>Prev';
				if(size!="large"){
					PrevLink=PrevLink+' Feed Set';
					}
				PrevLink=PrevLink+'</strong></a> ';*/
				
				PrevLink='<a class="prev" style="text-decoration:none;"><img src="/css/images/newbutton-'+color+'-newer-disabled.gif" width="48" height="20" alt="Newer" border="0"/></a>';
				
			}
			if(response > (nextpage*6)-6) {
				/* READDRESS WHEN WE LOOK AT THE INVESTOR SIDE OF THINGS AGAIN
				NextLink='<a onclick="loadCompFeed('+company_id+','+nextpage+',\''+size+'\')" class="next"><strong>Next';
				if(size!="large"){
					NextLink=NextLink+' Feed Set';
					}
				NextLink=NextLink+'</strong></a> ';*/
				
				NextLink='<a onclick="loadCompFeed('+company_id+','+nextpage+',\''+size+'\',\''+color+'\')" class="next" style="text-decoration:none;"><img src="/css/images/newbutton-'+color+'-older.gif" width="48" height="20" alt="Older" border="0"/></a> ';
			}
			else {
				/* READDRESS WHEN WE LOOK AT THE INVESTOR SIDE OF THINGS AGAIN
				NextLink='<a class="next" style="color: #DDD;"><strong>Next';
				if(size!="large"){
					NextLink=NextLink+' Feed Set';
					}
				NextLink=NextLink+'</strong></a> ';*/
				
				NextLink='<a class="next" style="text-decoration:none;"><img src="/css/images/newbutton-'+color+'-older-disabled.gif" width="48" height="20" alt="Older" border="0"/></a> ';
				
				}
				$("corplatestnewslink").innerHTML=PrevLink+' '+NextLink;
				fin2 = 1;
				if(fin1 == 1){
					$("corplatestnewswrapper").style.display="block";
					$("corplatestnews").removeChild(image);
				}
			}
		}
		);
	}
