function ajax_load(_page) {
	
	var _pageload = new AjaxRequest("scripts/php/sql2xml.php","table=hyp_items&id="+_page,"ajax_load_parse",_page);
}

function ajax_load_parse(_xml,_id) {
	
	var _content = _xml.getElementsByTagName("content")[0].firstChild.data;
	
	document.getElementById("main").innerHTML = decodeURIComponent(_content);
}

function getRSS(_stream,_name) {
	
	$.ajax({
		type: "GET",
		url: _stream,
		cache: false,
		dataType: "xml",
		success: function(_xml){
	
			_html = '<div class="block_title">'+_name+'</div>';
				
  			$(_xml).find("item").each(function() {
				
				_pubDate = new Date($(this).find("pubDate").text());
				_currentDate = new Date;
		
				_html += '<div class="news_date">';
				_html += _pubDate.getDate() + '.' + (_pubDate.getMonth() + 1) + '.' + _pubDate.getFullYear();
				_html += '</div>';
				if(_pubDate.getTime() > _currentDate.getTime() - 864000000) {	// if younger than ten days make bold
					_html += '<div class="news_text"><a href="' + $(this).find("link").text() + '" class="news_link" style="font-weight:bold;">';
				} else {
					_html += '<div class="news_text"><a href="' + $(this).find("link").text() + '" class="news_link">';
				}
				_html += $(this).find("title").text();
				_html += '</a></div>';
				
      		});
			
			$("#news").html(_html + $("#news").html());
		}
	});
}


// utility functions

function TagParser(_xml) {	
	
	_xml.normalize(); 			// needed to merge 4KB chunks in Gecko
	
	// properties
	this.xml = _xml;
	
	// methods
	this.gEbTN = _gEbTN;
	this.gEsbTN = _gEsbTN;
	
	function _gEbTN(_tagname,_id) {
		
		if(!_id) { _id = 0; }
		
		try {
			return this.xml.getElementsByTagName(_tagname)[_id].firstChild.data;
		} catch(e) {
			return "";		
		}
	}
	
	function _gEsbTN(_tagname) {
		
		try {
			return this.xml.getElementsByTagName(_tagname);
		} catch(e) {
			return "";		
		}
	}
	
}

function gEbI(_id) {
	
	return document.getElementById(_id);
}

function gEsbN(_id) {
	
	return document.getElementsByName(_id);
}

function gopen() {
	window.open('custom/gmap.html','google maps','width=700,height=500,left=200,top=200,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0');
}

