$(document).ready(function(){

	// DROPDOWN MENUS
	$('#menubar ul').supersubs({ 
            minWidth:    10,   // minimum width of sub-menus in em units 
            maxWidth:    20,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 

	// SLIDESHOW
	/* removed per Amy Price 8-30-10
	$('#slideshow').innerfade({
		speed:'slow',
		timeout:10000,
		containerheight:'92px'
	});
	*/
	$('#slideshow').css({height :'92px'});



	// MAKE RELATIVE URLS ABSOLUTE
	$('#main a:not([href^="http://"]').attr('href', function(){
		var url = window.location.href.split('/');
		url.pop();
		url.push($(this).attr('href'));
		return url.join('/');
	});


	// IMAGE UPLOAD
	var thumb = $('img#thumb');	
	new AjaxUpload('image_upload', {
		action: 'ajax_upload.php',
		name: 'photo',
		onSubmit: function(file, extension) {
			$('div#image_preview').addClass('loading');

			// disabled submit
			$('#submit').attr('disabled','disabled').addClass('disabled');
		},
		onComplete: function(file, response) {
			thumb.load(function(){
				$('div#image_preview').removeClass('loading');
				thumb.unbind();
			});
			thumb.attr('src', response);
			
			// set the hidden field
			$('#uploaded_image').val(file);
			
			// enable submit
			$('#submit').removeAttr('disabled').removeClass('disabled');
		}
	});

});