

$(document).ready( function(){ 
							
	$('ul#newsticker').innerfade({ animationtype:'maa', speed:750, timeout:8000, type:'sequence', containerheight:'82px' }); 
	
	$('div.loginhelp').hide();
	
	$('#loginboxdiv *').bind("mouseenter",function() {
		if(typeof(logintimeout)!='undefined') { clearTimeout(logintimeout); }
		$('div.loginhelp').slideDown();
	});
	/*.bind("mouseleave",function() {
		var logintimeout = window.setTimeout("$('div.loginhelp').slideUp()",5000);
		$('div.loginhelp').slideUp();
	});*/
	
	$('#change_theme').change(function(e){
		$.cookie('maa_theme',$(this).val(),{expires:365});
		//$(this).parent().submit(); // submit the form and reload the page
		var h = $('#theme_stylesheet').attr('href');
		
		h = h.split('/');
		h = h[h.length-1];
		
		var start = h.search(/-/);
		var end = h.search(/\.css$/);
		if (start > -1)
		{
			h = h.replace(h.substring(start,end),$(this).val());
			$('#theme_stylesheet').attr('href', '/css/'+h);
		}
		else
		{
			$('#theme_stylesheet').attr('href','/css/' + h.substring(0,end) + $(this).val() + '.css');
		}
		//$(this).parent().submit();
	});
	
	$('.audiofile').each( function (i) {
		$(this).after('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="516" height="80"><param name="movie" value="/images/mp3player.swf"><param name="quality" value="high"><param name="FlashVars" value="AudioPath=' + $(this).attr('href') + '"><embed src="/images/mp3player.swf" width="516" height="80" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="AudioPath=' + $(this).attr('href') +'"></embed></object>');
		$(this).remove();
	});
});


/* check a form and require all 'inputrequired' class inputs */
function checkEnquiry(f) {
	for (i=0; i<f.length; i++) {
		if (f[i].className.match(/inputrequired/) ) {
			if (f[i].type=="text") {
				if (f[i].value=="") { 
					alert("Please complete all required fields"); f[i].focus(); return false; 
				}
			}
			else if (f[i].type=="textarea") {
				if (f[i].value=="") {
					alert("Please complete all required fields"); f[i].focus(); return false;
				}
			}
			else if (f[i].type=="select-one") { 
				if (f[i].options[selectedIndex].value==""  ||  $f[i].selectedIndex==-1) { 
					alert("Please choose an option"); f[i].focus(); return false;
				}
			}
		} /* end class matching */
	} /* end for loop */
	return true;
}



// toggle sections
function sectionToggle(e) {
	$(e).parent('li').children('ul').toggle(); 
	if ($(e).val()=='+') {
		$(e).val('-'); 
	} 
	else { 
		$(e).val('+');
	}
}

