var Msg=new Array();
var pMsg=new Array();
importXML("HighlightArea","All");

news_data=Msg;
event_data=pMsg;

function importXML(loc, type)
{
  file="news.xml";
	if (document.implementation && document.implementation.createDocument)
	{
		//alert("You are using W3 compatible browser");		
		browser="w3";
		xmlDoc = document.implementation.createDocument("", "", null);			
		xmlDoc.load(file);
		xmlDoc.onload=function () {
			if (type =="ProgChange" || type =="Other")			
			{
				getData("ProgChangeArea","ProgChange")
				getData("OtherArea","Other")
			}
			else
			{
				getData(loc, type);
			}
		}
	}
	else if (window.ActiveXObject)
	{
		//alert("You are using MSIE");
		browser="ie";
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");	
		xmlDoc.async=false;		
		xmlDoc.load(file);
		getData(loc, type);
		//alert(str);
 	}
	else
	{
		alert('Your browser can\'t handle this script\nPlease use either IE6.0 or Netscape 8.0 or above');
		return;
	}
}

function getData(loc, type)
{
  
	if (type=="All")
	{
		if (browser=="w3") clearXML();
	  var x = xmlDoc.getElementsByTagName('NItem');
    
	  //(x.length>3) ? Max=3:Max=x.length;
	  Max=x.length;
	  j=0;
	  k=0;
	  for (i=0;i<Max;i++)
	  {
      if (x[i].getAttribute("type")=="ProgChange")      
      {
        //Msg[j]="<div class=datefield>Posted on " + x[i].childNodes[0].firstChild.nodeValue + "</div>";
        Msg[j]="<div class=datefield><br /></div>";
  		  Msg[j]=Msg[j] + "<div class=datefieldvalue>";
  		  if (x[i].childNodes[1].getAttribute("link")==null)
  		  {
          Msg[j]=Msg[j] + "<a href=content_news.htm>";
        }
        else
        {
          Msg[j]=Msg[j] + "<a href=" + x[i].childNodes[1].getAttribute("link") + " target=_top>";
        }
	 	    Msg[j]=Msg[j] + "" + x[i].childNodes[1].firstChild.nodeValue;
	   	  Msg[j]=Msg[j] + "</a></div>"; 	
        j=j+1;	  
	   	}
      if (x[i].getAttribute("type")=="Other")
      {
        if(x[i].childNodes[5].firstChild.nodeValue==1)
        {
         //pMsg[k]="<div class=datefield>Posted on " + x[i].childNodes[0].firstChild.nodeValue + "</div>";
         pMsg[k]="<div class=datefield><br/></div>";
  		   pMsg[k]=pMsg[k] + "<div class=datefieldvalue>";
  		   if (x[i].childNodes[1].getAttribute("link")==null)
  		   {
          pMsg[k]=pMsg[k] + "<a href=content_news.htm>";
         }
         else
         {
          pMsg[k]=pMsg[k] + "<a href=" + x[i].childNodes[1].getAttribute("link") + " target=_top>";
         }
	 	     pMsg[k]=pMsg[k] + "" + x[i].childNodes[1].firstChild.nodeValue;
	   	   pMsg[k]=pMsg[k] + "</a></div>"; 	
          k=k+1;
        }	  
	   	}
      
  	}
	}
}
function clearXML()
{
//Clear Empty node (Netscape only)
	var x = xmlDoc.getElementsByTagName('NItem');
	//alert(x.length);	
	for (i=0;i<x.length;i++)
	{
		//alert(i + "Initial:" + x[i].childNodes.length);
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) x[i].removeChild(x[i].childNodes[j]);
		}
		//alert(i + "Final:" + x[i].childNodes.length);
	}
}
