var xmlHttp
var xmlHttp2
var which
function getlatest(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
which = 1;  
var url="getlatestnews.asp";
url=url+"?type="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=function() {

 		if (xmlHttp.readyState==4) {
			document.getElementById("qw").innerHTML=xmlHttp.responseText;
			var stripoutput = xmlHttp.responseText.replace("($","");
			if (stripoutput != "Enter a valid code. -"){
				try {
					document.checkoutform.promocodecost.value= stripoutput.replace(")","");
				} catch (e) {
					// do nothing
				}
			}	
		}

 	};
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

xmlHttp2=GetXmlHttpObject();
xmlHttp2.onreadystatechange=function() {

 		if (xmlHttp2.readyState==4) {

			var xmldata= xmlHttp2.responseXML;
			//alert("hello");
			if(xmldata==null || xmldata.getElementsByTagName("item").length==0){ //if no <item> elements found in returned content
				document.getElementById("qw2").innerHTML="<b>Error</b> fetching remote RSS feed!<br />";
				return;
			}

			feeditems=xmldata.getElementsByTagName("item");
			var innerhtm = ""; 

			//Cycle through RSS XML object and store each peice of the item element as an attribute of the element
			//feeditems.length
			
			var hash = {
				"Jan":"January",
				"Feb":"February",
				"Mar":"March",
				"Apr":"April",
				"May":"May",
				"Jun":"June",
				"Jul":"July",
				"Aug":"August",
				"Sep":"September",
				"Oct":"October",
				"Nov":"November",
				"Dec":"December"
			}
			
			for (var i=0; i<1; i++){
				var nice_time = feeditems[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue.split(" ");
				nice_time = hash[nice_time[2]] + " " + nice_time[1] + ", " + nice_time[3];
				innerhtm += "<p class='tilesbold'><strong>"+feeditems[i].getElementsByTagName("title")[0].firstChild.nodeValue+"</strong></p>";
				innerhtm += "<p class='author-line'>" + nice_time + "</p>";
				content = feeditems[i].getElementsByTagName("description")[0].firstChild.nodeValue;
				innerhtm += "<p class='post-content'>" + content.substr(0,149)+ " ...</p>";
				innerhtm += "<p style='float:left'>(<a href='"+feeditems[i].getElementsByTagName("link")[0].firstChild.nodeValue+"'>Click here to read the full post</a>)</p>";
				innerhtm += "<p style='float:right'><a class='rss-link' style='float: right;' href=\"http://revenuecycleinc.com/blog/?feed=rss2&amp;p=3\">RSS Feed</a></p>";
			}
			var qw2 = document.getElementById("qw2");
			if(qw2 != null) {
			qw2.innerHTML = innerhtm;
			//document.getElementById("qw2").innerHTML = "hell"; 		
			}
		}

 	};

url2="blog/?feed=rss2";
which=2;
xmlHttp2.open("GET",url2,true);
xmlHttp2.send(null);
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}