function promptDelete()
{
	return confirm("Are you sure you want to permanently delete this?");
}

function promptModerate()
{
	return confirm("Are you sure you want to moderate this record as valid?\nEmails will be sent to the moderators or members for notification.");
}

window.addEvent('domready', function() {


	var myMenu = new MenuMatic({ opacity: '100', hideDelay: '600' });
	$$('#nav .top').addEvent('click',function(el){
		el.stop();
	});

	
	
	var submenu_panels = $$('.submenu div.panel');
	var submenu_triggers = $$('.submenu ul a.panel');
	var submenuSlideFx = new Array();
	
	submenu_panels.each(function(thisExpandable, i) {
		var newFX = new Fx.Slide(thisExpandable, {
			duration: 200,
			'onComplete':
				function(thisExpandable) {
					var hidden = thisExpandable.getParent().getStyle('height') == '0px' ? true : false;
					thisExpandable.getParent().setStyle('height','');
					if(window.ie6 && hidden) thisExpandable.getParent().setStyle('height','0px');
				}
		}).hide();
		
		submenuSlideFx[i] = newFX;
	});


	submenu_triggers.each(function(thisTrigger, i) {
		thisTrigger.addEvent('click', function(e) {
			e.stop();
	
			if ( thisTrigger.hasClass('active') ) {
				thisTrigger.removeClass('active');
			} else {
				thisTrigger.addClass('active');
			}

/*
			submenuSlideFx.each(function(thisis, i2){
				if ( submenuSlideFx[i2].open ) {
					triggers[i2].removeClass('active');
					if ( $defined(triggers2[i2]) ) {
						triggers2[i2].removeClass('active');
					}
					submenuSlideFx[i2].slideOut();
				}
			});
*/
			submenuSlideFx[i].toggle();
		});
	});


	
	$$('a.tip').addEvent('click', function(e){
		e.stop();
	});

	if ( $('photo-slide') ) {
		var hs1 = new noobSlide({
			box: $('photo-slide'),
			items: $$('#photo-slide .slide'),
			size: 296,
			interval: 5000,
			autoPlay: true,
			mode: 'horizontal',
			onWalk: function(currentItem,currentHandle){
			}
		});
	}
	
	$$('input[type=text]', 'input[type=password]', 'textarea').each(function(el){
		el.addEvent('focus', function(e){
			this.addClass('focused');
		});
		el.addEvent('blur', function(e){
			this.removeClass('focused');
		});
	});


	$$('.hyperlink-panels', '.articles-index').each(function(list, i){
		list.getElements('li').each(function(listelement){
			listelement.addEvent('click', function(e){
				if ( $defined(listelement.getElement('a')) && !listelement.getParent('ul').hasClass('noclick') ) {
					if ( listelement.getElement('a').get('target') == '_blank' ) {
						window.open(listelement.getElement('a').get('href'));
					} else {
						document.location.href = listelement.getElement('a').get('href');
					}
				}
			});
			listelement.addEvent('mouseenter', function(e){
				if ( $defined(listelement.getElement('a')) ) {
					listelement.addClass('hover');
				}
			});
			listelement.addEvent('mouseleave', function(e){
				listelement.removeClass('hover');
			});
		});
	});
	
	
	if ( $defined($('video-channels')) ) {
		$('channel-changer').addEvent('change', function(e) {
			e.stop();
			var channel = $('channel-changer').get('value');
			if ( channel != '' ) {
				document.location.href = '/videos/' + channel + '.php';
			}
		});
	}

	/*
	http://davidwalsh.name/mootools-form-field-default-plugin
	*/
	var dwDefaults = new Class({
		//implements
		Implements: [Options],
	
		//options
		options: {
			collection: $$('input[type=text]')
		},
		
		//initialization
		initialize: function(options) {
			//set options
			this.setOptions(options);
			this.defaults();
		},
		
		//a method that does whatever you want
		defaults: function() {
			this.options.collection.each(function(el) {
				if ( el.get('value') == '' ) {
					el.set('value',el.get('alt'));
				}
				el.addEvent('focus', function() { if(el.get('value') == el.get('alt')) { el.set('value',''); } });
				el.addEvent('blur', function() { if(el.get('value') == '') { el.set('value',el.get('alt')); } });
			});
		}
		
	});

	var defs = new dwDefaults({
		collection: $$('#dashboard-panel .defaultfield')
	});




	
	$$('table.resultset tr').each(function(el,i){
		classname = ( i % 2 ) ? 'odd' : 'even';
		if ( !el.hasClass('buttons') && !el.getParent('table').hasClass('no-highlight') ) {
			el.addClass( classname );
		}
		
		if ( !el.getParent('table').hasClass('no-highlight') ) {
			el.addEvent('mouseenter', function(e){
				el.addClass('hover');
			});
			el.addEvent('mouseleave', function(e){
				el.removeClass('hover');
			});
		}
	});


	$$('td.radio-switch1').each(function(el,i){
		el.addEvent('click', function(e) {
			var row = el.getParent('tr');
			row.toggleClass('changed');
			
			var radio_inputs = row.getChildren('td').getChildren('input');
			
			radio_inputs.each(function(el2,i2){
				if ( i2 == 1 ) {
					if ( radio_inputs[1].get('checked') == 'true' ) {
						radio_inputs[1].set('checked', 'false');
						radio_inputs[2].set('checked', 'true');
					} else {
						radio_inputs[2].set('checked', 'false');
						radio_inputs[1].set('checked', 'true');
					}
				}
			});
		});
	});
	

});