(function($){
get_news = function(news_dir,news_url,news_dom) {

	//var news_dir = "news/";
	news_dir=news_dir+"/";
	news_url=news_url+".xml";
	var news_doc = news_dir+news_url;
	var newsdom = '#'+news_dom;
	
	$.ajax({
                 type: "GET",
                 url: news_doc,
                 dataType: "xml",
                 cache:false,
                 success: function(xml) {
            
			var html = '';
			var id_text = '';
			var news_text = '';
			var news_section = '';
			var news_type = '';
			var date_text ="";

			
			//var newscounter = 20;
//html +='<div style="background-color:#000;">'; 
html +='<ul>'; 					
                 	$(xml).find('item').each(function(){
                        id_text = $(this).find('id').text();
 			news_text = $(this).find('newstext').text();
 			news_section = $(this).find('section').text();
			news_type = $(this).find('type').text();			
 			
 			date_text = $(this).find('date').text();

//split into array - see if date is < today's date
var dateparts = new Array(); 
dateparts = date_text.split('/'); 		
var listdate = dateparts[2]+"/"+dateparts[1]+"/"+dateparts[0];
//is date less than today - format Ymd
if (Date.parse(listdate) < Date.parse(currentDate) ) {
date_text = "";
}
 
 if (date_text !="") {
			date_text	= date_text.replace(/\//g,'-');
html +='<li class="line_bottom"><img src="images/newsicon2.gif" /><a class="newslist" href="index.php?p='+news_section+'&type='+news_type+'&id='+id_text+'&date='+date_text+'">';
html += news_text+'<\/a><\/li>'
} else {
html +='<li class="line_bottom"><img src="images/newsicon2.gif" /><a class="newslist" href="index.php?p='+news_section+'&type='+news_type+'&id='+id_text+'">';
html += news_text+'<\/a><\/li>'
}

 			//newscounter =  newscounter+1;
                        });  
                       
html +='<\/ul>'; 
//html +='<\/div>'; 

                         $(newsdom).html(html);  
                         xml="";
                         
//$('.jScrollPaneContainerx').jScrollPaneRemove();
$('.jScrollPaneContainerx').jScrollPane();                         
                         
                } 
                



 	  });  









          }           
})(jQuery);
