
var win; //Used for DEBUG FUNCTION
var g_page; //Containse the page id of the current page
var g_struct = new Array(); //Array contains the complete structure
top.g_domain = 'webdevserver';
top.g_root_page = 'default.asp';
top.g_root_page = 'site.asp';
top.g_url_params = [];
top.g_init_funcs = [];


function get_page_url (id) {
	//return top.g_root_page+'?page='+id;
	return id+'.htm';
}

//top.debug=true;
/*
Name: INIT
Description:
Gets called when page is loaded
*/
function init(){
top.g_app_dir = gen_app_dir(top.siteRootDir);
top.g_docs_pdf_root = top.siteContentDir+'/docs/pdf/'; //Root dir for PDF's
top.g_docs_doc_root = top.siteContentDir+'/docs/doc/'; //Root dir for Word Documents
top.g_image_content_root = top.siteContentDir+'/images/'; //Root dir for images
top.g_image_news_root = top.siteContentDir+'/images/news_release/'; //Root dir for news releases
top.g_image_support_root = top.g_app_dir+'images/support/'; //Root dir for Support images
var _page = document.getElementById('display_page');
	url_parse();
	try{
		structure_init();
		structure_build();
	}catch(err){
		alert('There was a problem with your request');	
	}
	_page.innerHTML = page_wrapper();
	template_build();
	images_update_src();
	links_update('left_nav_tbl');
	links_update('page_content');
	loading_finished();
	loading_defaults();
}

function gen_app_dir(_rootDir){
var _ret;
	if(_rootDir==''||!_rootDir)return '';
	var _x = _rootDir.split('/');
	_ret = '';
	for(var i=0;i<_x.length;i++){
		_ret+='../';
	}
	return _ret;
}

function loading_defaults(){
var _node = node_get(top.g_page);
	if(_node){
		switch(_node.title.toLowerCase()){
			case 'search':search_execute(1);	
		}
	}
}

/*
Name: db() and db_close()
Description:
Used for debugging, writed the supplied param _str to a popup window
db_close is called when the current window/document is closed, this closes the popup window.
*/
function db(_str){
	if(!top.debug)return;
	if(!win)
		win=window.open('blank.html','_blank');
	win.document.write('\n\n\n'+_str+'\n\n\n'+' <br><br> ');
}
function db_close(){
	if(win){
		win.close();
	}
//	if(top.g_sitemap){
//		top.g_sitemap.close();	
//	}
}

/*
Name: browser_check(_class)
Description:
This checks the current browser being used it and returns the type.
If _class is passed it appends an extension on to the end of the class depending on the browser, 
this is then returned instead of the browser type. 
*/
function browser_check(_class){
var _ret;
	if(navigator.userAgent.split('Firefox').length>1){
		_ret = 'firefox';
	}else if(navigator.userAgent.split('MSIE').length>1){
		_ret = 'ie';
	}else{
		_ret = 'unknown';
	}
	if(_class){
		switch(_ret){
			case 'firefox':_ret = _class+'_ff';break;
			default:_ret = _class;break;
		}
	}
	return _ret;
}

/*
Name: url_parse()
Description:
This parses the current url for parameters
*/
function url_parse(){
var _url = document.location.href+'';
	_url = _url.split('?');
	_path = _url[0];
	_path = _path.split('http://');
	if(_path.length>1){
		_path = _path[1].split('/')[0];
		g_domain = _path;
	}
	if(_url.length==2){
		_params = _url[1].split('&');
		for(var i=0;i<_params.length;i++){
			_param = _params[i].split('#')[0];
			_tst = _param.split('=');
			if(_tst.length>1){
				top.g_url_params[_tst[0]]=_tst[1];
				if(_tst[1]!=''){
					if(isNaN(_tst[1])){
						eval('g_'+_tst[0]+'=\''+_tst[1]+'\'');
					}else{
						eval('g_'+_tst[0]+'='+_tst[1]);						
					}
				}
			}
		}
	}
}



/*
Name: structure_build()
Description:
This is called at the beginning to build the heirarchy and relationships between the nodes
*/
function structure_build(){
var _htm = new Array();
	if(top.g_structure){
		var _root = structure_getRoot();
		if(_root){
			_root.children = structure_getChildren(_root);
			top.g_structure_aa['N'+_root.id]=_root;
		}
	}
	_nav = document.getElementById('structure');
	_cont = document.getElementById('content');
}



/*
Name: structure_getRoot()
Description: 
This gets the root node for the entire site.
*/
function structure_getRoot(){
	if(top.g_root_node){
		for(var i=0;i<g_structure.length;i++){
			if(g_structure[i].id==g_root_node){
				return g_structure[i];
			}
		}
	}else{
		for(var i=0;i<g_structure.length;i++){
			if(g_structure[i].parent == 0){
				return g_structure[i];
			}
		}	
	}
}

/*
Name: structure_getChildren()
Description: 
This populates the property array .children for the given node which is passed in through _obj
*/
var count = 0;
var g_structure_aa = new Array();
function structure_getChildren(_obj){
var _child = new Array();
	count++;
	g_structure_aa[_obj.id]=_obj;
	for(var i=0;i<g_structure.length;i++){
		if(g_structure[i].title=='PARARI'){
//			alert(g_structure[i].site_root);	
		}
		if(g_structure[i].parent==_obj.id&&!g_structure[i].site_root){
			g_structure[i].children = structure_getChildren(g_structure[i]);
			g_structure[i].parent_obj=_obj;
			g_structure_aa['N'+g_structure[i].id]=g_structure[i];
			_child[_child.length]=g_structure[i];
		}
	}
	return _child;
}

function site_nav(_query){
	alert(top.g_root_page+'x?'+_query);
 	top.window.open(top.g_root_page+'?'+_query,'_self');	
}


/*
Name: links_update()
This parses html and fixes and any legacy links from the old system that still resides within the HTML
*/
/*
function links_update(_elm_id){
var _root = document.getElementById(_elm_id);
if(!_root)return;
var _a = _root.getElementsByTagName('A');
	for(var i=0;i<_a.length;i++){
		_a[i].onmouseover=function(){
			link_hover_over(this);
			var _id = this.id.split('LN');
			//alert(_id);
			if(_id.length>1){
				menu_hide_all();
				menu_build_sub(_id[_id.length-1],this);	
			}
		}
		_a[i].onmouseout=function(){
			link_hover_out(this);
		}
		var _file = _a[i].href.split('/');
		_file = _file[_file.length-1];
		var _url = _a[i].href.split('-');
		var _web = _a[i].href.split(g_domain);
		var _pdf = _a[i].href.split('.pdf');
		var _doc = _a[i].href.split('.doc');
		var _mpg = _a[i].href.split('.mpg');
		var _mpg = _a[i].href.split('.mpg');
		var _email = _a[i].href.split('@');
		if(_a[i].href != 'javascript:void(0)'){
			if(_pdf.length>1){
				var _href = links_pdf(_a[i]);
				_a[i].target = '_self'; 
				_a[i].href = 'javascript:void(0)';
				_a[i].onclick='popup_doc(\''+_href+'\')';
	//			var _href = g_docs_pdf_root+_file;
				eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
			}else if(_doc.length>1){
				if(_a[i].href.split('/newsdocs/').length==1){
					var _href = g_docs_doc_root+_file;
				}else{
					var _href = _a[i].href;		
				}				
				_a[i].target = '_self'; 
				_a[i].href = 'javascript:void(0)';
				eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
			}else if(_web.length==1&&_a[i].href!=''&&_url.length!=5){
				_a[i].target = '_self'; 
				var _href = _a[i].href;
				_a[i].href = 'javascript:void(0)';
				eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
			}else if(_url.length==5){
				var _orig = _a[i].href.split('/');
				if(!g_page)
					g_page = '';
				_a[i].href = g_root_page+'?page_original='+_orig[_orig.length-1]+'&pr='+g_page;
			}else if(_url.length==7||_url.length==6){
	//			alert(_url.length);
				var _orig = _a[i].href.split('/');
				var _link = _orig[_orig.length-1].split('-');
				var _sect = _link[0];
				_orig = [];	
				for(var j=1;j<_link.length;j++){
					_orig[_orig.length]=_link[j];	
				}
				_orig = _orig.join('-');
				if(!g_page)
					g_page = 0;
				_a[i].href = g_root_page+'?page_original='+_orig+'&pr='+g_page+'&sect='+_sect;
			}
		}
	}
}
*/

/*
Name: links_update()
This parses html and fixes and any legacy links from the old system that still resides within the HTML
*/
function links_update(_elm_id){
var _root = document.getElementById(_elm_id);
if(!_root)return;
var _a = _root.getElementsByTagName('A');
	for(var i=0;i<_a.length;i++){
		if(_a[i].href != 'javascript:void(0)'){
			_a[i].onmouseover=function(){
				link_hover_over(this);
				var _id = this.id.split('LN');
				//alert(_id);
				if(_id.length>1){
					menu_hide_all();
					menu_build_sub(_id[_id.length-1],this);	
				}
			}
			_a[i].onmouseout=function(){
				link_hover_out(this);
			}
			var _file = _a[i].href.split('/');
			_file = _file[_file.length-1];
			var _ftype = links_type(_a[i]);
	//	alert(_a[i].href+'  :  '+_ftype);
			switch(_ftype){
				case 'pdf':
					var _href = links_pdf(_a[i]);
					_a[i].target = '_self'; 
					_a[i].href = 'javascript:void(0)';
					_a[i].onclick='popup_doc(\''+_href+'\')';
		//			var _href = g_docs_pdf_root+_file;
					eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
					break;
				case 'doc':
					if(_a[i].href.split('/newsdocs/').length==1){
						var _href = './'+top.siteContentDir+'/docs/news/'+_file;
					}else{
						var _href = _a[i].href;		
					}				
					_a[i].target = '_self'; 
					_a[i].href = 'javascript:void(0)';
					eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
					break;
				case 'web' : 
					_a[i].target = '_self'; 
					var _href = _a[i].href;
					_a[i].href = 'javascript:void(0)';
					eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
					break;
				case 'orig' :
					var _orig = _a[i].href.split('/');
					if(!g_page)
						g_page = '';
					_a[i].href = g_root_page+'?page_original='+_orig[_orig.length-1]+'&pr='+g_page;
					break;
				case 'orig_direct' :
					var _orig = _a[i].href.split('/');
					var _link = _orig[_orig.length-1].split('-');
					var _sect = _link[0];
					_orig = [];	
					for(var j=1;j<_link.length;j++){
						_orig[_orig.length]=_link[j];	
					}
					_orig = _orig.join('-');
					if(!g_page)
						g_page = 0;
					_a[i].href = g_root_page+'?page_original='+_orig+'&pr='+g_page+'&sect='+_sect;
					break;
				case 'video' :
					var _href = links_video(_a[i]);
					_a[i].target = '_self'; 
					_a[i].href = _href;
	//				_a[i].onclick='popup_doc(\''+_href+'\')';
		//			var _href = g_docs_pdf_root+_file;
	//				eval('_a[i].onclick=function(){popup_doc(\''+_href+'\');}');
					break;
				
			}
		}
	}
}


function links_type(_link){
var _ext = _link.href.split('.');
var _web = _link.href.split(g_domain);
var _mail = _link.href.split('mailto:');
var _filename = _link.href.split('/');
	_filename = _filename[_filename.length-1];
var _orig = _filename.split('-');
	if(_ext.length>1){
		_ext = _ext[_ext.length-1];
		switch(_ext){
			case 'mpeg':return 'video';break;
			case 'mpg' :return 'video';break;
			case 'avi' :return 'video';break;
			case 'mov' :return 'video';break;
			case 'doc' :return 'doc';break;
			case 'pdf' :return 'pdf';break;
			case 'xls' :return 'xls';break;
		}
	}
	if(_web.length==1&&_link.href!=''&&_mail.length==1){
		return 'web';	
	}
	if(_orig.length>4){
		if(isNaN(_orig[0])){
			return 'orig_direct';	
		}else{
			return 'orig';	
		}
	}
	return null;
}


function links_pdf(_link){
var _x = _link.href.split('/docs/news/');
	if(_x.length>1){
//		alert('news');
		_y = './'+top.siteContentDir+'/docs/news/'+_x[1];
		return _y;
		eval('_link.onclick=function(){popup_doc(\''+_y+'\');}');			
	}else{
		_x = _link.href.split('/docs/brochures/');
		if(_x.length>1){
//			alert('brochure');
			_y = './'+top.siteContentDir+'/docs/brochures/'+_x[1];
			return _y;
			eval('_link.onclick=function(){popup_doc(\''+_y+'\');}');	
		}else{
			_x = _link.href.split('/');
			if(_x.length>1){
//				alert('legacy');
				_y = './'+top.siteContentDir+'/docs/pdf/'+_x[_x.length-1];
				return _y;
				eval('_link.onclick=function(){popup_doc(\''+_y+'\');}');
			}
		}
	}
}

function links_video(_link){
var _x = _link.href.split('/video/');
	if(_x.length>1){
		_y = './'+top.siteContentDir+'/video/'+_x[1];
		return _y;
		eval('_link.onclick=function(){popup_doc(\''+_y+'\');}');			
	}
	return '';
}



/*
Name: popup_doc(_url)
Decsription:
This opens the given _url up in a new window, if the window has been opened previously it should be focussed when the page/doc has loaded
*/
var g_win;

/**
function popup_doc(_url,_name,_win_params){
	if(!_name)_name='doc';
	if(!_win_params)_win_params='resizable,scrollbars,width=800,height=600,status,menubar';
	var _win = window.open('blank.html?'+_url,_name,_win_params);
	top.g_win = _win;
	setTimeout('popup_focus(\''+_url+'\')',1000);
	return _win;
}
*/

function popup_doc(_url,_name,_win_params){
	if(!_name)_name='doc';
	if(!_win_params)_win_params='resizable,scrollbars,width=800,height=600,status,menubar,location=1';
	var _win = window.open(_url,_name,_win_params);
	top.g_win = _win;
	setTimeout('popup_focus(\''+_url+'\')',1000);
	return _win;
}


function popup_focus(_url){
	if(top.g_win){
		g_win.focus();
		g_win.document.location.href = _url;		
	}
}

/*
Name: link_hover_over(_elm) and link_hover_out(_elm)
Desc:
These functions are called on mouseover and mouseut events they basically switch the classes depending on the event
*/
function link_hover_over(_elm){
var _class = _elm.className.split('_hover');
	if(_class.length==1){
		_elm.className = _class[0]+'_hover';
	}
}
function link_hover_out(_elm){
var _class = _elm.className.split('_hover');
	if(_class.length>1){
		_elm.className = _class[0];
	}
}

/*
Name: images_update_src()
Description:
This parses the content for any image links and updates the url so that it points at the correct location
*/
function images_update_src(){
var _content = document.getElementById('page_content');
var _imgs = _content.getElementsByTagName('IMG');
	for(var i=0;i<_imgs.length;i++){
		var _img = _imgs[i].src.toLowerCase().split('/');
		_img = _img[_img.length-1];
		var _img_images = _imgs[i].src.toLowerCase().split('/images/');
		var _img_layout = _imgs[i].src.toLowerCase().split('/layout/');
		var _img_sup = _imgs[i].src.toLowerCase().split('/support/');
		var _img_news = _imgs[i].src.toLowerCase().split('/news_release/');
		if(_img_layout[i]){
			
		}
		//alert(_img_layout.length);
		if(_img_layout.length==1){
			if(_img_sup.length>1){
				_img = g_image_support_root+_img;
			}else if(_img_news.length>1){
				_img = g_image_news_root+_img;
			}else{
				_img = g_image_content_root+_img;
			}
		}else{
			_img = _imgs[i].src;
		}
		_imgs[i].src = _img;
	}
}


function str_post_fix(_str){
	_str = escape(_str);
	//_str = _str.split("''").join("'");
	return _str;
}

function str_disp_fix(_str){
	//_str = _str.split("'").join("''");
	_str = unescape(_str);
	return _str;
}

var g_curPos;
document.onmousemove=function(event){
	g_curPos = getPosition(event);
}

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

function node_get(_id){
var _ret;
	for(var i=0;i<g_structure.length;i++){
		//alert(g_structure[i].id+'=='+_id)
		if(g_structure[i].id==_id){
			return 	g_structure[i];
		}
	}
	return null;
}

function find_next_parent(_elm,_tag){
var _parent = _elm.parentElement||_elm.parentNode;
var _ret;
	if(!_parent)return null;
	if(_parent.tagName==_tag){
		_ret = _parent;	
	}else{
		_ret = find_next_parent(_parent,_tag);
	}
	return _ret;
}

function menu_build_sub(_id,_elm){
var _node = node_get(_id);
var _htm = new Array();
var _cursor = g_curPos;
var _targ = document.getElementById('sub_nav');
var _p = _node.parent_obj;
var _pMenu = document.getElementById('SM'+_p.id);
var _x,_y;
	if(_pMenu){
		_y = _cursor.y;;
		_x = _pMenu.offsetLeft+_pMenu.offsetWidth-100;
	}else{
		_x = _elm.offsetLeft+40;
		_y = _elm.offsetTop;
	}
	if(_node){
		if(!document.getElementById('SM'+_id)&&_node.children.length>0){
		_node.menuOn = true;	
		_htm[_htm.length]='<div id="SM'+_id+'" class="'+browser_check('sub_menu')+'" style="z-index:2; position:absolute; top:'+(_y)+'px;left:'+(_x)+'px; visibility:hidden; display:none;" onmouseover="" onmouseout="">';
			_htm[_htm.length]='<ul>';
			g_sortfield='order';
			_node.children.sort(fn_sort_compare);
			for(var i=0;i<_node.children.length;i++){
				if(_node.children[i].source_type=='EXTLINK'){
					_htm[_htm.length]='<li class="sub_item"><a href="javascript:void(0)" onClick="popup_doc(\'http://'+_node.children[i].source+'\')" onmouseover="menu_build_sub('+_node.children[i].id+',this);">'+_node.children[i].title+'</a> <img src="./images/icons/world2.gif"></li>';
				}else if(_node.children[i].source_type=='INTLINK'){
					_htm[_htm.length]='<li class="sub_item"><a href="'+get_page_url(_node.children[i].source)+'" onmouseover="menu_build_sub('+_node.children[i].id+',this);">'+_node.children[i].title+'</a></li>';
				}else{
					_htm[_htm.length]='<li class="sub_item"><a href="'+get_page_url(_node.children[i].id)+'" onmouseover="menu_build_sub('+_node.children[i].id+',this);">'+_node.children[i].title+'</a></li>';
				}
			}
			_htm[_htm.length]='</ul>';
		_htm[_htm.length]='</div>';
		_targ.innerHTML+=_htm.join('');
		}
		var _menu = document.getElementById('SM'+_id);
		for(var i=0;i<_p.children.length;i++){
			if(_p.children[i].id!=_node.id){
				menu_hide(_p.children[i].id);
			}
		}
		if(_menu){
		_menu.style.visibility = 'visible';
		_menu.style.display = 'block';
		}
	}
}	

function menu_hide_to(_id){
	setTimeout('menu_hide('+_id+')',500);	
}

function menu_hide(_id){
var _node = node_get(_id);
var _menu = document.getElementById('SM'+_id);
var _hide = true;
	for(var i=0;i<_node.children.length;i++){
		//alert(_node.children[i].menuOn)
//		if(_node.children[i].menuOn == true){
//			_hide = false;	
//		}
		menu_hide(_node.children[i].id);
	}
	if(_hide&&_menu){
		_node.menuOn = false;
		_menu.style.visibility = 'hidden';
		_menu.style.display = 'block';		
	}
}

function menu_hide_all(){
var _targ = document.getElementById('sub_nav');
_targ.innerHTML = '';	
	
}

function dE(_id){
	return document.getElementById(_id);	
}

function dT(_id,_tag){
var _elm = dE(_id);
	if(!_elm){
		_elm = document;	
	}
	return _elm.getElementsByTagName(_tag);
}

function format_block(_str){
	_str = _str.split('\n').join('<br>');	
	return _str;
}

function template_build(_id){
var _temp = document.getElementById('d_template');
var _tempContent = document.getElementById('d_template_content');
	if(_temp){
		var _il = dE('inside_links');
		if(_il){
			_il.innerHTML = page_build_inside_links();	
		}
		var _divs = _temp.getElementsByTagName('DIV');
		for(var i=0;i<_divs.length;i++){
			var _id = _divs[i].id;
			var _c = document.getElementById('TC'+_id);
			if(_c){
				_divs[i].innerHTML = _c.innerHTML;	
			}
		}
	}else{
		var _t = dE('page_content');
		_t.innerHTML = page_build_inside_links()+_t.innerHTML;
	}
}


/*
Name: ado_pagination(_coll)
Description:
This creates pagination links based an obj_collection(_coll) this is 
populated when a paginated recordset is returned by ADO 2.0
*/
function ado_pagination(_coll,_func,_hideDetails){
var _htm = [];
var _page,_pages,_records,_max_num,_year;
	_year = dE('i_year');
	if(!_year){
		var _cDate = new Date();
		_year = _cDate.getFullYear();
	}else{
		_year = _year.value;		
	}
	if(_coll){
		_page = _coll.page*1;	
		_pages = _coll.pages*1;	
		_records = _coll.records*1;	
		_max_num = _coll.max_num*1;	
	}else{
		return null;	
	}
	var _st = _page*_max_num-_max_num+1;
	var _en = _st+_max_num-1;
	if (_en > _records){
		_en = _records;	
	}
	var _next,_prev;
	if(_page==1){
		_prev = _page;	
	}else{
		_prev = _page-1;	
	}
	if(_page==_pages){
		_next = _page;	
	}else{
		_next = _page+1; 	
	}
	_tot_nums = 10;
	var _before = _page-(_tot_nums/2);
	var _after = _page+((_tot_nums/2)-1);
	if(_before<1||_pages<10){
		_init = 1			
	}else{
		_init = _before;	
		if((_after-_pages) > 0){
			_init-=(_after-_pages);	
		}
	}
	//alert(_before+','+_init)
	//_htm[_htm.length]='<div>Displaying items '+_st+' to '+_en+'</div>';
	_htm[_htm.length]='<table class="pagination" border=0 cellpadding=0 cellspacing=0 style=" padding-right:10px;">';
		_htm[_htm.length]='<tr>';
//			_htm[_htm.length]='<td class="transport"><img src="images/icons/rwoff.gif" onClick="news_live('+_year+','+_max_num+','+_prev+')"></td>';
			_htm[_htm.length]='<td class="transport" onClick="'+_func+'(null,'+_max_num+','+_prev+')"><b>&lt;&lt;</b></td>';
				for(var i=0;i<_tot_nums;i++){
					if(_init>_pages){
							_htm[_htm.length]='<td class="page_num">&nbsp;</td>';				
					}else{
						if(_init==_page){
							_htm[_htm.length]='<td class="page_num_current"><a onClick="'+_func+'(null,'+_max_num+','+_init+')"><b>'+_init+'</b></a></td>';
						}else{
							_htm[_htm.length]='<td class="page_num"><a onClick="'+_func+'(null,'+_max_num+','+_init+')">'+_init+'</a></td>';
						}
					}
					_init++;
				}
//			_htm[_htm.length]='<td class="transport"><img src="images/icons/ffoff.gif" onClick="news_live('+_year+','+_max_num+','+_next+')"></td>';
			_htm[_htm.length]='<td class="transport" style="text-align:right;" onClick="'+_func+'('+_year+','+_max_num+','+_next+')">&gt;&gt;</td>';
//			if(!_hideDetails)
//				_htm[_htm.length]='<td class="details">Found '+_records+' items, displaying '+_st+' to '+_en+'</td>';
		_htm[_htm.length]='</tr>';
		if(_hideDetails){
			_htm[_htm.length]='<tr>';
				_htm[_htm.length]='<td class="details" colspan='+_tot_nums+' style="padding:0px;">'+_records+' items, displaying '+_st+' to '+_en+'</td>';
			_htm[_htm.length]='</tr>';
		}
	_htm[_htm.length]='</table>';
	if(!_hideDetails)
		_htm[_htm.length]='<div style="margin-bottom:10px;" class="details">Found '+_records+' items, displaying '+_st+' to '+_en+'</div>';
	return _htm.join('');
}

function sitemap_open(){
	top.g_sitemap = popup_doc('structure.html','sitemap','width=800,height=600,resizable,scrollbars');
}

function show_loading(_id){
var _targ = dE(_id);	
var _htm='';
	if(_targ){
		_htm+= '<table cellpadding=0 cellspacing=0 border=0 style="width:100%; height:100%;">';
		_htm+= '<tr><td style=" vertical-align:middle;text-align:center;">';
		_htm+= '<img src="'+g_image_support_root+'loader_gif.gif" style="border:0px solid black;">';
		_htm+= '</td></tr>';
		_htm+= '</table>';
		//alert(_targ.innerHTML);
		_targ.innerHTML=_htm;
		//alert(_targ.innerHTML);
	}
}

function gen_goto_element(_id){
	var _targ = dE(_id);
	if(top.g_goto_element){
		if(top.g_goto_element.tagName.toLowerCase()=='img'){
			top.g_goto_element.style.border = 'solid 0px white';	
		}
	}
	if(_targ){
		_targ.focus();	
		_targ.style.border = 'solid 2px yellow';	
		top.g_goto_element = _targ;
	}
}

function element_show(_id){
var _elm = dE(_id);
	_elm.style.visibility='visible';
	_elm.style.display='block';
}

function element_hide(_id){
var _elm = dE(_id);
	_elm.style.visibility='hidden';
	_elm.style.display='none';
}

function DL_GetElementLeft(eElement)
{
    if (!eElement && this)                       // if argument is invalid
    {                                            // (not specified, is null or is 0)
        eElement = this;                         // and function is a method
    }                                            // identify the element as the method owner
    
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}

function DL_GetElementTop(eElement)
{
    if (!eElement && this)
    {
        eElement = this;
    }

    var nTopPos = eElement.offsetTop;
    var eParElement = eElement.offsetParent;
    while (eParElement != null)
    {
        nTopPos += eParElement.offsetTop;
        eParElement = eParElement.offsetParent;
    }
    return nTopPos;
}


