jQuery.noConflict();

jQuery(function() {

	// Form submission indicators and effects
	jQuery('.indicator').hide();
	jQuery('form').submit(
		function() {
			jQuery(this).children('.indicator').show();
			//jQuery('.actions').html('<span class="indicator"><img src="' + relBaseUrl + '/img/lightbox/lightbox-ico-loading.gif" alt="Please wait..." />Please wait</span>');
		}
	);
		
	// Fade status message box
	jQuery('#flashMessage').animate({
		backgroundColor: '#ffe',
		borderTopColor: '#eed',
		borderRightColor: '#eed',
		borderBottomColor: '#eed',
		borderLeftColor: '#eed',
		color: '#cbb'
	},5000);

	// Gallery lightbox effect
	jQuery('.gallery a').lightBox();
	
	// Header image links
	jQuery('#image_buyersguide').click(
		function() {
			location.href = baseUrl + '/' + buyersguideUrl;
		}
	);
	jQuery('#image_currentissue').click(
		function() {
			location.href = baseUrl + '/issues';
		}
	);
	
	// SSL icon notice
	jQuery('.ssl_icon').hover(
		function() {
			jQuery('.ssl_notice').show();
		},
		function() {
			jQuery('.ssl_notice').hide();
		}
	);
		
	// Toggles
	jQuery('span.toggle').click(
		function() {
			// Toggle item
			jQuery(this).parent().parent('.toggle_container').children('.toggle_content').toggle();
			// Change toggle cursor
			var toggle_state = jQuery(this).parent().parent('.toggle_container').children('.toggle_content').css('display');
			if (toggle_state == 'block') {
				jQuery(this).css({'background-image':'url(' + baseUrl + '/img/icons/custom/toggle_open.png)'});
			}
			else {
				jQuery(this).css({'background-image':'url(' + baseUrl + '/img/icons/custom/toggle_closed.png)'});
			}
		}
	);
	jQuery('a.toggle_link').click(
		function() {
			var target = jQuery(this).attr('href').substr(jQuery(this).attr('href').indexOf('#')+1);
			jQuery('#'+target).children('.toggle_content').show();
			jQuery('#'+target).children().children('.toggle').css({'background-image':'url(' + baseUrl + '/img/icons/custom/toggle_open.png)'});
		}
	);
	
	// Toggle checkboxes
	jQuery('input.toggle_group_trigger').click(
		function() {
			if (jQuery(this).attr('checked') != '') {
				jQuery(this).parent().parent().children('div').children('input').attr('checked','checked');
			}
			else {
				jQuery(this).parent().parent().children('div').children('input').removeAttr('checked');
			}
		}
	);

		
});

