$(document).ready(function() {
  $('.cycler-display-first').load('panel1.htm', null, function() {
    // start_cycler();
  });
});

// controls the banrnav menu in the image banner
$(document).ready(function() 
	{
	// these classes mark a <div> for swapping for each button
	var current_div = '.cycler-display-first';
	var next_div = '.cycler-display-second';

// this associates nav content to the swapping <div> tag
	$('ul#toolnav li > a').click(function(ev) 
		{
		var tmp_div = '';
		var page_url = '';
		ev.preventDefault();
		$('ul#toolnav li > a').removeClass('selected');
		page_url = $(this).attr('href');
		$(this).addClass('selected');
    	$(next_div).load(page_url, null, function() 
			{
  			$(current_div).fadeOut(150, function() 
				{
  				$(current_div).html($(next_div).html());
					$(next_div).html('');
				  $(current_div).fadeIn(1000, function() {
					  if (page_url == 'panel5.htm') {
							start_cycler();
						} else if (page_url == 'panel7.htm') {
							$('#seminarForm').validate({
								submitHandler: function(form) {
									jQuery(form).ajaxSubmit({
										target: "#seminar_form_div",
										success: function() {
											$('#seminar_form_success').fadeIn(500);
										}
									})
								}
							})
						} else if (page_url == 'panel8.htm') {
							$('#quickForm').validate({
								submitHandler: function(form) {
									jQuery(form).ajaxSubmit({
										target: "#quick_form_div",
										success: function() {
											$('#quick_form_success').fadeIn(500);
										}
									})
								}
							})
						}
				  });
				});		
			});
  		});
	});

function start_cycler() {
    $('#tipshow').cycle({
      fx:      'fade',
      speed:   'slow',
      timeout: 0,
			cleartype: 1,
      next:    '#next2'
    });
	}
	

