﻿function loadXML(fileName)
{
if (window.ActiveXObject) var xmldoc= new ActiveXObject("Microsoft.XMLDOM");
else if (window.XMLHttpRequest) {var xmlRequest = new XMLHttpRequest();xmlRequest.open("GET",fileName,false);xmlRequest.send(null); return xmlRequest.responseXML;}
else if (document.implementation&&document.implementation.createDocument) xmldoc=document.implementation.createDocument("","doc",null);
xmldoc.async=false;
xmldoc.load(fileName);
return xmldoc;
}

function AddShortNews(To)
{
var panel = document.getElementById(To); 
var img = new Image();
img.src="images/Calendar.gif";
panel.appendChild(img);


var img1 = new Image();
var anchor = document.createElement("a");
anchor.href="http://www.softeka.com/promo";

img1.src="images/mainevent.jpg";
//img1.src="images/events.gif";
anchor.appendChild(img1);
panel.appendChild(anchor);

xmldoc = loadXML("news.xml");

var root=xmldoc.documentElement;
 if (root.hasChildNodes()) {
  var child = root.firstChild;
	do { var par = document.createElement("p");
	var bold = document.createElement("b");
	var br = document.createElement("br");
	var newsdate = document.createTextNode(child.getAttribute("Date"));
	var newsline = document.createTextNode(child.getAttribute("Name"));
	par.className = "newsline";
	bold.appendChild(newsdate);
	par.appendChild(bold);
	par.appendChild(br);
	par.appendChild(newsline);
	var href = child.getAttribute("href");
	if (href)
		{var anchor = document.createElement("a");
		var txt = document.createTextNode(" >>>");
		anchor.href=href;
		anchor.appendChild(txt);
		par.appendChild(anchor);}

	panel.appendChild(par);
	child = child.nextSibling;
	} while (child)
 }
par = document.createElement("p");
anchor = document.createElement("a");
newsline = document.createTextNode("Подробнее >>>");
par.className = "allnews";
anchor.href="news.html";
anchor.appendChild(newsline);
par.appendChild(anchor);
panel.appendChild(par);
return;
}

function AddNews(To)
{var panel = document.getElementById(To); 

xmldoc = loadXML("news.xml");

var root=xmldoc.documentElement;
 if (root.hasChildNodes()) {
  var child = root.firstChild;
	do { var par = document.createElement("p");
	var bold = document.createElement("b");
	var H5 = document.createElement("H5");
	var newsdate = document.createTextNode(child.getAttribute("Date"));
	var newsline = document.createTextNode(child.getAttribute("Name"));
	var news = document.createTextNode(child.firstChild.nodeValue);
	var href = child.getAttribute("href");
	bold.appendChild(newsdate);
	H5.appendChild(newsline);
	par.appendChild(news);
	par.className = "newsline";
	panel.appendChild(bold);
	panel.appendChild(H5);
	var href = child.getAttribute("href");
	if (href)
		{var anchor = document.createElement("a");
		var txt = document.createTextNode(" подробнее>>>");
		anchor.href=href;
		anchor.appendChild(txt);
		par.appendChild(anchor);}
	panel.appendChild(par);
	
	child = child.nextSibling;
	} while (child)
 }
par = document.createElement("p");
var anchor = document.createElement("a");
newsline = document.createTextNode("все события>>>");
par.className = "allnews";
anchor.appendChild(newsline);
par.appendChild(anchor);
panel.appendChild(par);
return;
}
