	var getDataNEWS
	var noPhotoNews = 'images/news_media/nophoto_s.gif'
	function getXMLNEWS(url)
	{
		var a = 'd='+ Math.random()*100;
		//alert(a)
		sendRequest(url, readXMLNEWS, 'GET', a);
	}
	function readXMLNEWS(req)
	{
		
		getDataNEWS = req.responseXML.getElementsByTagName('news');
		//alert('a');
		createListNEWS('')
	}

	
	function createListNEWS(getRegion)
	{
			clearContentsNEWS()
			var items = getDataNEWS[0].getElementsByTagName('item');
			//alert(items.length)
			
			var tambElem="";
			for(z = 0; z < items.length; z++)
			{
				var p = Math.floor(z / numOfItem) * numOfItem;
				
				var n = items[z].getElementsByTagName('id');
				var id =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				var n = items[z].getElementsByTagName('date');
				var date =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				var n = items[z].getElementsByTagName('region');
				var region =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				var n = items[z].getElementsByTagName('title');
				var title =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				var n = items[z].getElementsByTagName('bodytext');
				var bodytext =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				var n = items[z].getElementsByTagName('thumbpath');
				if(n[0].hasChildNodes()){
					var image =(n[0].hasChildNodes())? n[0].childNodes[0].nodeValue:'';
				}else{
					var image = noPhotoNews;
				}
				
				if(getRegion == '' || getRegion == region || (getRegion == 4 && region == 6)){
					
					/* output layout format 
					<table>
						<tr>
							<th><img src="images/p1.png" alt="photo1" /></th>
							<td><small>2009-01-11 Region: Japan</small>
								<h4>WFC Superiority: Shake Table Test Weathers 200% of the Kobe Earthquake</h4>
								<p>On September 25th Canada Wood conducted a full scale shake table test of a 3-storey post and beam...</p>
							</td>
						</tr>
					</table>
					*/
					
					
					
					tambElem +='<tr>';
					tambElem +='<th><a href="news_media.php?cnum='+p+'#'+id+'"><img src="'+image+'" alt="'+title+'" /></a></th>';
					tambElem +='<td>';
					tambElem +='<small>'+date+' '+country[region]+'</small>';
					tambElem +='<h4><a href="news_media.php?cnum='+p+'#'+id+'">'+title+'</a></h4>';
					tambElem +='<p>'+bodytext+'</p>';
					tambElem +='</td></tr>';
				}
			//	alert(items[z].getElementsByTagName('date'))
			}
			var tableElem ='';
			
			if(tambElem != ''){
				tableElem = '<table cellpadding="0" cellspacing="0">'+tambElem+'</table>';
			}else{
				if(getRegion)
					tableElem = '<h3>There are no news items currently posted for this region</h3>';
				else
					tableElem = '<h3>There are no news items currently posted.</h3>';
			}
			
			if(items.length == 0){
				tableElem = '<h3>There are no news items currently posted.</h3>';
			}
			//alert(tambElem)
			//document.getElementById("plist").appendChild(tambElem)
			document.getElementById("newsbox").innerHTML = tableElem;
	}
	
	function clearContentsNEWS(){
		var childs = document.getElementById("newsbox").childNodes;
		var l = childs.length;
		//alert(l)
		for(var i =0; i < l ; i++)
		{
			document.getElementById("newsbox").removeChild(childs[0])
		}
	}

