MM_preloadImages('images/nav_orange_back.gif');

function IsArray(obj) { return obj instanceof Array; }
function IncludeLibraries(libraries) {
	libraries.each(function(library) {
		document.write('<script type="text/javascript" src="' + library + '"></script>');
	});
}
function IncludeStyles(styles) {
	styles.each(function(style) {
		document.write('<link rel="stylesheet" type="text/css" media="all" href="' + style + '" />');
	});
}
function SetNotice(content, status) {
	// :KLUDGE: having to force background colors
	//          highlight effect isn't reading new color
	//          from dynamically set classname
	// status related colors
	var colors = new Array();
	colors['success'] = '#fff1bd';
	colors['error']   = '#ffcfce';
	var bgcolor = (status) ? colors[status] : colors['success'];
	
	// update notice
	var e = $('notice');
	e.update(unescape(content));
	e.className = 'notice-' + ((status) ? status : 'info');
	e.show();
	new Effect.Highlight(e, {duration:1.5, keepBackgroundImage:true, startcolor:'#fce798', endcolor:bgcolor, restorecolor:bgcolor});
}
function ClearNotice() {
	var e = $('notice');
	e.update('');
	e.hide();
}
function PopWindow(title, url, width, height, modal) {
	var id = 'popwindow';
	if (!$(id)) {
		BuildWindow({id:id, title:title, url:url, width:width, height:height, modal:modal});
	}
}
function SafeMail(name, domain, addinfo) {
	style     = (addinfo.style)   ? ' class="' + addinfo.style + '"' : '';
	subject   = (addinfo.subject) ? '?subject=' + addinfo.subject : '';
	displayed = (addinfo.display) ? addinfo.display : name + '@' + domain;
	mailto    = name + '@' + domain + subject;
	document.write('<a href="mailto:' + mailto + '"' + style + '>' + displayed + '</a>');
}
function ToggleElement(id) {
	if ($(id)) { $(id).toggle(); }
}
function Mailto(address) {
	var url    = '/ajax_mailto.php';
	var pars   = 'address=' + address;
	new Ajax.Request(url, {
		method:'post',
		parameters:pars,
		onComplete:function(req) {
			window.location = req.responseText;
		}
	});
}
function StripeTable(id) {
  $A($(id).getElementsByTagName('tbody')).each(function(tbody) {
    $A(tbody.immediateDescendants()).each(function(row, i) {
      row.className = (i % 2) ? 'odd' : 'even';
    });
  });
}
function RemoveRow(id, table) {
  // remove row
  Element.remove(id);
  
  // restripe table
  StripeTable(table);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
