	// common js functions

	var isIE = navigator.userAgent.indexOf('Internet Explorer') >= 0;
	var isN = document.getElementById && !document.all;

	function showElement(elmnt, display){show(elmnt, (!display ? "inline" : display));}
	function hideElement(elmnt){hide(elmnt);}

	function hide(){
		if(hide.arguments.length > 0){
			var el = hide.arguments[0];
			el = (typeof(el) == "string") ? document.getElementById(el) : el;
			if(el && typeof(el) == "object") el.style.display = "none";
		}
		return false;
	}//hide

	function show(){
		if(show.arguments.length > 0){
			var display = show.arguments.length > 1? show.arguments[1] : "block";
			var el = show.arguments[0];
			el = (typeof(el) == "string") ? document.getElementById(el) : el;
			if(el && typeof(el) == "object") el.style.display = display;
		}
		return false;
	}//show

	function openPopup(url,n,w,h,s){
		if(n == null) n = '';
		if(!w) w = 700;
		if(!h) h = 550;
		s = s == true ? "1" : "0";
		if(url) window.open(url,n,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+s+',resizable=1,width='+w+',height='+h);
	}//openPopup



	function deleteRecord(recordID, recordName){
		if(recordID > 0 && (frm = document.getElementById('form_records'))){
			if(!recordName) recordName = "record";
			if(confirm("Are you sure you want to delete this " + recordName + "?")){
				frm.elements.id_to_delete.value = recordID;
				frm.submit();
			}
		}
		return false;
	} // /deleteRecord()

	function publishRecord(recordID){
		if(recordID > 0 && (frm = document.getElementById('form_records'))){
			frm.elements.id_to_publish.value = recordID;
			frm.submit();
		}
		return false;
	} // /publishRecord()



	function siteTopMenu(){
		var t,m;
		function mopen(e){if(e.length){mcancelclosetime();if(!m||m.get(0)!=e.get(0)){mclose();m=e;m.slideDown(400);}}}
		function mclose(){if(m){m.slideUp(300);m=null;}}
		function mclosetime(){t=setTimeout(mclose,300);}
		function mcancelclosetime(){if(t){clearTimeout(t);t=null;}}
		$(document).click(mclose);
		$('#site_top_menu .item').each(function(i,e){
			$('a',e).first().mouseover(function(){mopen($('.items',e));});
			$('a',e).first().mouseout(mclosetime);
			$('.items',e).mouseover(mcancelclosetime);
			$('.items',e).mouseout(mclosetime);
		});
	}//siteTopMenu


