// Forces a confirmation before allowing any link to take you outside of the current site
function blockExternalLinks(){
	var anchors = $$('a');
	for(i=0;i<anchors.length;i++){
		anchors[i].addEvent('click', function(){
			if(!this.href.match(document.domain) && this.href.match('http')){
				var ext_bg = new Element('div', {'id' : 'extNotify'});
				ext_bg.set('opacity', 0);
				ext_bg.addEvent('click', function(){
					fader = new Fx.Tween(ext_bg);
					fader.addEvent('onComplete', function(){ext_bg.dispose();});
					fader.start('opacity', 0);
				});
				ext_bg.innerHTML = 
				'<table id="ext_table" cellpadding="0" cellspacing="0" height="100%" width="100%"><tr>'+
				'<td id="ext_container" align="center" valign="middle"></td></tr></table>';
				var ext_confirm = new Element('div');
				ext_confirm.innerHTML = 
				'<table id="ext_content" cellpadding="20" cellspacing="0"><tr>'+
				'<td  valign="middle">'+
				'<h1>Notice:</h1>'+
				'You have clicked on a link that will take you outside of this site.<br>'+
				'Here is the URL:<br>'+
				'<a onClick="location.href=this.href;" href="'+this.href+'">'+this.href.replace('http://','').slice(0, -1)+'</a><br>'+
				'If you would like to continue, please click the URL above.<br>'+
				'Click outside this box to cancel.'+
				'</td></tr></table>';
				ext_bg.inject(document.body);
				ext_confirm.injectInside($('ext_container'));
				$('ext_content').addEvent('click', function(){return false});
				ext_bg.fade(0, 0.9);
				return false;
			}
		});
	}
}

function menu_toggle(target, current){
	if(current || (!current && $('currentDrop').value != target)){
		$($('currentDrop').value+'_drop').fade('out');
	}
	if(current){
			$(current+'_drop').fade('in');
			$('currentDrop').value = current;
	}
	else{
			$(target+'_drop').fade('in');
			$('currentDrop').value = target;
	}
}
