$(document).ready(function(){
	//set up the main banner tabs
	$('#panel_tabs a').click(function(event){
		div = $(this).parent();
		$('#panel_tabs li').removeClass('selected');
		div.addClass('selected');
		matches = div.attr('id').match(/tab_(\d+)/);
		if (matches) {
			id = matches[1] - 1;
			$('#panels').animate({left: (id * -898) + 'px'}, 500); 
		}
		event.preventDefault();
	});

	//set up the next button in the main banner
/*
	$('a.next_btn').mouseover(function(event){
		$(this).css('background-position', '0px -34px');
	});
	$('a.next_btn').mouseout(function(){
		$(this).css('background-position', '0px 0px');
	});
	$('a.next_btn').mousedown(function(){
		$(this).css('background-position', '0px -68px');
	});
	$('a.next_btn').mouseup(function(){
		$(this).css('background-position', '0px 0px');
	});
*/
	$('a.next_btn').click(function(event){
		matches = $(this).parent().attr('id').match(/panel_(\d+)/);
		if (matches) {
			next_id = parseInt(matches[1]) + 1;
			$('#panel_tabs li').removeClass('selected');
			$('#tab_'+ next_id).addClass('selected');
			$('#panels').animate({left: ((next_id - 1) * -898) + 'px'}, 500); 
		}
		event.preventDefault();
	});

	$('a.xbig_button').mouseover(function(event){
		$(this).css('background-position', '0px -46px');
	});
	$('a.xbig_button').mouseout(function(){
		$(this).css('background-position', '0px 0px');
	});
	$('a.xbig_button').mousedown(function(){
		$(this).css('background-position', '0px -92px');
	});
	$('a.big_button').mouseover(function(event){
		$(this).css('background-position', '0px -42px');
	});
	$('a.big_button').mouseout(function(){
		$(this).css('background-position', '0px 0px');
	});
	$('a.big_button').mousedown(function(){
		$(this).css('background-position', '0px -84px');
	});
	$('a.button').mouseover(function(event){
		$(this).css('background-position', '0px -34px');
	});
	$('a.button').mouseout(function(){
		$(this).css('background-position', '0px 0px');
	});
	$('a.button').mousedown(function(){
		$(this).css('background-position', '0px -68px');
	});
	$('a.button').mouseup(function(){
		$(this).css('background-position', '0px 0px');
	});

	$('a.submit').click(function(event){
		form = $(this).closest('form');
		form_elem = form.get(0);	
		if (typeof form_elem.onsubmit == "function")
		{
			form_elem.onsubmit();
		}
		form.submit();
		event.preventDefault();
	});

/*
	$('a.start_trial').click(function(event){
		$(this).closest('form').submit();	
		event.preventDefault();
	});
*/

	$('form.auto_submit').each(function(){
		$(this).submit();
	});

 });



