$(document).ready(function(){
	var isIE = $.browser.msie && parseInt($.browser.version.substring(0,1)) < 8;
	
	var pregPrice     = '39';
	var postPregPrice = '39';
	
	if(!isIE)
	{
		$('#paynow').css('opacity', 0.25);
		$('#choices a').css('opacity', 0.2);
	}
	else $('#paynow').hide();
	
	$('.disclaimer').load('/disclaimer.html div', function(){
		$('#agree').show().click(function(){
			if(!isIE)
			{
				if($(this).attr('checked')) $('#paynow').fadeTo('fast', 1).attr('disabled', '');
				else $('#paynow').fadeTo('fast', 0.25).attr('disabled', 'disabled');
			}
			else
			{
				if($(this).attr('checked')) $('#paynow').show().attr('disabled', '');
				else $('#paynow').hide().attr('disabled', 'disabled');
			}
		});
		
		$('#preg-plan').click(function(e){
			e.preventDefault();
			
			openForm();
			
			$(this).attr('active', 'active');
			$('#post-preg-plan').attr('active', '');
			
			if(!isIE) $(this).fadeTo('fast', 1);
			if(!isIE) $('#post-preg-plan').fadeTo('fast', 0.2);
			
			$('#price').fadeTo('fast', 0, function(){
				$('#digits').text(pregPrice);
				$(this).css('color', '#810043');
				$(this).fadeTo('fast', 1);
			});
			$('#form input[name="hosted_button_id"]').val('1884477');
			
		}).mouseover(function(){
			if($(this).attr('active') != 'active' && !isIE)
				$(this).fadeTo('fast', 0.5);
		}).mouseout(function(){
			if($(this).attr('active') != 'active' && !isIE)
				$(this).fadeTo('fast', 0.2);
		});
		$('#post-preg-plan').click(function(e){
			e.preventDefault();
			
			openForm();
			
			$(this).attr('active', 'active');
			$('#preg-plan').attr('active', '');
			
			if(!isIE) $(this).fadeTo('fast', 1);
			if(!isIE) $('#preg-plan').fadeTo('fast', 0.2);
			
			$('#price').fadeTo('fast', 0, function(){
				$('#digits').text(postPregPrice);
				$(this).css('color', '#0073b2');
				$(this).fadeTo('fast', 1);
			});
			$('#form input[name="hosted_button_id"]').val('1884507');
			
		}).mouseover(function(){
			if($(this).attr('active') != 'active' && !isIE)
				$(this).fadeTo('fast', 0.5);
		}).mouseout(function(){
			if($(this).attr('active') != 'active' && !isIE)
				$(this).fadeTo('fast', 0.2);
		});
		
		$('#form form').submit(function(e)
		{
			if(!$('#agree').attr('checked')) e.preventDefault();
		});		
	});
});

function openForm()
{
	$('#form').slideDown(500);
	
	sIFR.replace(helvetica, {
	  selector: '#form h2',
	  wmode: 'transparent',
	  forceSingleLine: true,
	  css: {
	    '.sIFR-root': {
	      'color': '#10155e'
	    }
	  }
	});
}