﻿function getBlogNews()
{
// Create XML doc
//  loadDocument is routine from General js to create XML doc
//  setXMLValue is routine from General js to insert info into the XML doc
//  sendDoc is routine from General js to send the document to backend
//  getXMLValue is routine from General js to get info from XML Doc
	loadDocument("xml/blogNews.xml");
// Insert data into XML doc
	setXmlValue("functionName", "getBlogNews");
	setXmlValue("message", "blog news view Message");
	//alert(xmlDoc.xml);
    xmlDoc = sendDoc("aspx/blogNews.aspx");
	//alert(xmlDoc.xml);
// Insert news into HTML page
	var blogNewsRegExp = /\r|\n|\r\n/g;
	var blogHeadLine = getXmlValue("blogHeadline");
    blogHeadLine = blogHeadLine.replace(blogNewsRegExp);
	document.getElementById("blogHead").innerHTML = blogHeadLine;
	if(blogHeadLine == "No blog content at this time")
	{
	    document.getElementById("readmore").disabled = true;
	}
	else
	{
	    document.getElementById("readmore").disabled = false;
	}
	var blogNewsRegExp = /\r|\n|\r\n/g;
    var blogString = getXmlValue("blogContent");
   // blogString = blogString.replace(blogNewsRegExp);
    blogString = blogString.replace(blogNewsRegExp, "<br />");
	document.getElementById("blogBlurb").innerHTML = blogString;
	var newsHeadLines = getXmlValue("newsHeadline");
    newsHeadLines = newsHeadLines.replace(blogNewsRegExp, "<br />");
	document.getElementById("newsHeads").innerHTML = newsHeadLines;
}
////////////////////////////////////////////////////////
// Get a news and associated data from the data base 
// for viewing
////////////////////////////////////////////////////////
function viewNews(curNewsId)
{

//Switch from news listing to news view page
    location='news.html';
}
////////////////////////////////////////////////////////
// Get a news and associated data from the data base 
// for viewing
////////////////////////////////////////////////////////
function getNews()
{
// Create XML doc
//  loadDocument is routine from General js to create XML doc
//  setXMLValue is routine from General js to insert info into the XML doc
//  sendDoc is routine from General js to send the document to backend
//  getXMLValue is routine from General js to get info from XML Doc


	loadDocument("xml/blogNews.xml");
// Insert data into XML doc
	setXmlValue("functionName", "getNews");
	setXmlValue("message", "news get Message");
    //newsID = curNewsId;
    //setXmlValue("newsId", curNewsId);
	//alert(xmlDoc.xml);
    xmlDoc = sendDoc("aspx/blogNews.aspx");
	//alert(xmlDoc.xml);
// Insert blog into HTML page
	var newsRegExp = /\r|\n|\r\n/g;
	var newsString = datadif("news"); 
    newsString = newsString.replace(newsRegExp, "<br />");
	document.getElementById("newsList").innerHTML = newsString;
}
////////////////////////////////////////////////////////
// Get a news and associated data from the data base 
// for viewing
////////////////////////////////////////////////////////
function viewBlogs()
{

//Switch from news listing to news view page
    location='blog.htm';
}
////////////////////////////////////////////////////////
// Get a news and associated data from the data base 
// for viewing
////////////////////////////////////////////////////////
function getBlogs()
{
// Create XML doc
//  loadDocument is routine from General js to create XML doc
//  setXMLValue is routine from General js to insert info into the XML doc
//  sendDoc is routine from General js to send the document to backend
//  getXMLValue is routine from General js to get info from XML Doc

	loadDocument("xml/blogNews.xml");
// Insert data into XML doc
	setXmlValue("functionName", "getBlogs");
	setXmlValue("message", "blogs get Message");
	//alert(xmlDoc.xml);
    xmlDoc = sendDoc("aspx/blogNews.aspx");
	//alert(xmlDoc.xml);
// Insert blog into HTML page
	var blogRegExp = /\r|\n|\r\n/g;
	var blogString = datadif("blogs"); 
    blogString = blogString.replace(blogRegExp, "<br />");
	document.getElementById("blogList").innerHTML = blogString;
}
