$(document).ready(function(){
	$('#formHolder').danielForm({
		processUrl: 'sampleRequestProcess.php',
		form_id: 'form',
		btnTitle: 'SEND',
	    btnColor: '#0099FF',
		border: 'solid 2px #000',
		btnWidth: 4 
	});

//initial values/State
	$('input[type=radio]').css("border","none");
	upArrow = '../images/grfx/buttons/upArrowWht.gif';
	downArrow = '../images/grfx/buttons/downArrowWht.gif';
	//Add Select Menu Items for Inches
	$('select.inches').html('<option value="" selected="selected">Select</option><option value="1/2">1/2"</option><option value="5/8">5/8"</option><option value="3/4">3/4"</option><option value="7/8">7/8"</option><option value="1">1"</option><option value="1-1/8">1-1/8"</option><option value="1-1/4">1-1/4"</option><option value="1-3/8">1-3/8"</option><option value="1-1/2">1-1/2"</option><option value="1-5/8">1-5/8"</option><option value="1-3/4">1-3/4"</option><option value="1-7/8">1-7/8"</option><option value="2-1/8">2-1/8"</option><option value="2">2"</option>');
	$('option').css("textAlign","left");
//adding content 	
	$('.sectionHead').after('<div class="shrinkMsg" style="width:290px;padding:3px;float:left;color:red; background-color:white;text-align:center;"><strong>Enter Required Info before Collapsing</strong></div>');
	
//Hiding elements *** 
	$('#proFields, #isBelt, #curBelt, #curBeltNuHope, #curBeltOther, #curBeltOtherName, #iroundDiam, #ovalHeight, #ovalWidth, #outputCon, #shipTo, #refOther').slideUp('fast');
	$('.shrinkMsg').hide();	

		
// Sliding and Hiding ***************************************************************************
	$('select#type').change(function(){
		var selVal = $(this).attr('value');
		var outputCon = $('#outputCon');
		if(selVal == 'Colostomy' ||selVal == 'Ileostomy' ){outputCon.slideDown('slow'); 
		}else if(selVal == 'Urostomy'){outputCon.slideUp('slow');
			$('#outputCon').children('select').attr('class','noValid'); 
		}else{  
			$('#outputCon').children('select').attr('class','noValid').parent().slideUp('slow');
		}
	});
	
	/*$('select#profile').change(function(){
		var selVal = $(this).attr('value');
		var proDetail = $('#proDetail');
		var recDetail = $('#recDetail');
		if(selVal == 'Protruding'){
			proDetail.slideDown('slow').children('input, select').attr('class', 'valid');
			recDetail.slideUp('slow').children('input, select').attr('class', 'noValid'); 
		}else if(selVal == 'Recessed'){
			recDetail.slideDown('slow').children('input, select').attr('class', 'valid');
			proDetail.slideUp('slow').children('input, select').attr('class', 'noValid');
		}else{
			$('#proDetail, #recDetail').children('select').attr('class','noValid').parent().slideUp('slow');
		}
	});*/
	
	$('select#refer').change(function(){
		var selVal = $(this).attr('value');
		if(selVal=='Other'||selVal=='Pharmacy'){
			$('#refOther').slideDown('slow');
		}else{
			$('#refOther').slideUp('fast');
		}
	});
	
	$('select#curMfc').change(function(){
		var selVal = $(this).attr('value');
		var curBeltNuHope = $('#curBeltNuHope');
		var curBeltOther = $('#curBeltOther');
		var curBeltOtherName = $('#curBeltOtherName');
		if(selVal == 'Nu-Hope'){
			curBeltNuHope.slideDown('slow');
			curBeltOther.slideUp('slow');
			curBeltOtherName.slideUp('slow');
			$('#otherMfcName, #otherMfcNum').attr('class','noValid');
			$('#nuHopeMfcNum').attr('class','valid');
		}else if(selVal == 'Other'){
			curBeltOther.slideDown('slow');
			curBeltOtherName.slideDown('slow');
			curBeltNuHope.slideUp('slow');
			$('#otherMfcName, #otherMfcNum').attr('class','valid');
			$('#nuHopeMfcNum').attr('class','noValid');
		}else{
			$('#curBeltNuHope, #curBeltOther, #curBeltOtherName').children('input').attr('class','noValid').parent().slideUp('slow');
		}
	});
	
	// healthcare pro or patient?
	$('#relation_0').click(function(){
		$('#proFields, #shipTo').slideDown('slow');
		$('#profname, #prolname, #proemail, #prophone1, #prophone2, #prophone3, #procompany, #shipTo_0, #shipTo_1').addClass('valid').removeClass('noValid');
		$('#email, #phone1, #phone2, #phone3').addClass('noValid').removeClass('valid');
	});
	
	$('#relation_1').click(function(){
		$('#proFields, #shipTo').slideUp('slow');
		$('#profname, #prolname, #proemail, #prophone1, #prophone2, #prophone3, #procompany, #shipTo_0, #shipTo_1').addClass('noValid').removeClass('valid');
		$('#email, #phone1, #phone2, #phone3').addClass('valid').removeClass('noValid');
	});
	
	//is herniated => is belt worn => current belt
	$('#beltLit').hide();	
	$('#hernia_0').click(function(){$('#isBelt').slideDown('slow');$('#beltLit').hide();});
	
	$('#hernia_1').click(function(){
		$('#isBelt_1').trigger('click');
		$('#isBelt').slideUp('slow');
		$('#curBelt').slideUp('slow');
		$('#nuHopeMfcNum, #otherMfcName, #otherMfcNum, #curMfc').attr('class','noValid');
		$('#beltLit').show();
	});
	
	$('#isBelt_0').click(function(){
		$('#curBelt').slideDown('slow');
		$('#curMfc').attr('class','valid');
	});
	
	$('#isBelt_1').click(function(){
		$('#curBelt').slideUp('slow');
		$('#nuHopeMfcNum, #otherMfcName, #otherMfcNum, #curMfc').attr('class','noValid');

	});
	
	//stome shape => size =>	
	//Round
	$('#shape_0').click(function(){
		$('#roundDiam').slideDown('slow');
		$('#ovalWidth, #ovalHeight').slideUp('slow');
		$('#ovalWidth, #ovalHeight').children('input, select').attr('class','noValid');
		$('#roundDiam').children('input, select').attr('class','valid');
	});
	//Oval
	$('#shape_1').click(function(){
		$('#roundDiam').slideUp('slow');
		$('#ovalWidth, #ovalHeight').slideDown('slow');
		$('#ovalWidth, #ovalHeight').children('input, select').attr('class','valid');
		$('#roundDiam').children('input, select').attr('class','noValid');
	});
	
	$('.photoLink').danielPop({
		//openOn:"mouseover",
	    thumbNails:true,
		headerText: true,
		addButton: true,
		closeButton: true,
		initWidth: 150,
		initHeight: 150,
		imgMaxWidth: 500,
		imgMaxHeight: 300,
		bgColor: "white",
		yOffset:200,
		roundCorners: true,
		centerScreen: false,
		followMouse: true
     });

});// the end
