// This uses JQuery and JQuery UI to handle a tabbed box	
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.5.2");

google.setOnLoadCallback(function() 
{
	
	
	/* CONTACT FORM */
	/* General set-up and init */
	$step2 = jQuery("#stepTwo,#stepTwo h2,#stepTwo h3");
	$step3 = jQuery("#stepThree,#stepThree h2,#stepThree h3");
	$step4 = jQuery("#stepFour,#stepFour h2,#stepFour h3");
	
	//jQuery("#stage1 select#helpYou").val(''); /* reset select field */
	$step2.fadeTo(1000, 0.3);
	$step3.fadeTo(1000, 0.3);
	$step4.fadeTo(1000, 0.3);
	jQuery("#stepTwo input, #stepThree input, #stepThree textarea, #stepFour input").attr('disabled','true');
	
	/* Process Step One Inputs */
	jQuery("#interestedIn").css('display','none');
	if (jQuery("#stepOne select#enqtype :selected").val() != "") {
			if (jQuery("#stepOne select#enqtype :selected").val() == "I need additional information about n3w media") {
				jQuery("#interestedIn").slideDown("500");
			} else {
				jQuery("#interestedIn").slideUp("500");				
			}
			$step2.fadeTo(300, 1);
			jQuery("#stepTwo input").attr('disabled','');				
		}
	
	jQuery("#stepOne select#enqtype").change(function(){
			if (jQuery(this).val() == "") {
				jQuery("#stepTwo input, #stepThree input, #stepThree textarea, #stepFour input").attr('disabled','true');				
				$step2.fadeTo(300, 0.3);
				$step3.fadeTo(300, 0.3);
				$step4.fadeTo(300, 0.3);
			} else {
				if (jQuery(this).val() == "I need additional information about n3w media") {
					jQuery("#interestedIn").slideDown("500");
				} else {
					jQuery("#interestedIn").slideUp("500");				
				}
				$step2.fadeTo(300, 1);
				jQuery("#stepTwo input").attr('disabled','');				
			}
		});

	/* Process Step Two Inputs */
	jQuery("#stepTwo input").blur(function(){
		if (jQuery('#stepTwo').find('input[value!=""]').length >= 3) {
			$step3.fadeTo(300, 1);
			jQuery("#stepThree textarea, #stepThree input").attr('disabled','');
			$step4.fadeTo(300, 1);
			jQuery("#stepFour input").attr('disabled','');
			jQuery('#stepTwo input').removeClass('error');
		} else {
			// show error state
			$step3.fadeTo(300, 0.3);
			jQuery("#stepThree input").attr('disabled','');
			$step4.fadeTo(300, 0.3);
			jQuery("#stepFour input").attr('disabled','');
		}
	});

	


	/* The End */
});


