/*
 * C-form custom scripts
 *
 * Copyright (c) 2008 Barry Roodt / The YellowLlama (yellow-llama.com)
 * 
 */
$(document).ready(function(){
	$(".cformselect option[@value='other']").parent().parent().next("li").hide();
	$(".cformselect option[@value='Other']").parent().parent().next("li").hide();
	
	$("select.cformselect option[@value='other']").parent().change(function(){
		var txt = $("#" + this.id +" :selected").text();
		if (txt == "Other" || txt == "other"){
			$("#" + this.id).parent().next("li").fadeIn();
			
		} else {
			$("#" + this.id).parent().next("li").fadeOut();
		}
	});
	
	$("select.cformselect option[@value='Other']").parent().change(function(){
		var txt = $("#" + this.id +" :selected").text();
		if (txt == "Other" || txt == "other"){
			$("#" + this.id).parent().next("li").fadeIn();
			
		} else {
			$("#" + this.id).parent().next("li").fadeOut();
		}
	});
	
	$("#cforms3form fieldset").hide();
	$("#cforms3form select").change(function(){
		$("#cforms3form fieldset.cf-fs3").fadeIn();
		switch($(this).val()) {
			case "supplier":
				$("#cforms3form fieldset.cf-fs1").fadeIn();
				$("#cforms3form fieldset.cf-fs2").fadeOut();
			break;
			case "service":
				$("#cforms3form fieldset.cf-fs1").fadeOut();
				$("#cforms3form fieldset.cf-fs2").fadeIn();
			break;
			default:
				$("#cforms3form fieldset").fadeOut();
				break;
		}
	});
});