$(document).ready(function(){
	
	$('.clink').live("click",(function() {
		
		var t = $(this).attr("id"); 
		
		$('#c'+t).toggle();

			
		
			
			return false;
			
		}));
		
	$('.continue').live("click",(function() {
		
		var fwidth = $("input[name=width]").val();
		var fheight = $("input[name=height]").val();
		
		var t = $(this).attr("id"); 
		
		
		
		if(!$.trim(fwidth)){
			
			if(t=='C'){
				
				alert("Please provide us with the Projection value");
				return false;
			
			
				} else {
					alert("Please provide us with the Width value");
					return false;
			
					}
			
			}
			
		
		
		if(!$.trim(fheight)){
			
			if(t=='C'){
				
				alert("Please provide us with the Length value");
				return false;
				
				} else {
					
					alert("Please provide us with the Height value");
					return false;
			
					}
			
			
			}
			
		if(t=='C'){
			
			var c = $('#c_coms').val();
			
			if(!$.trim(c)){
				
				alert("Please provide us with some information on your Conservatory");
				return false;
				
				}
			
			}
			
			return true;
			
		}));
		
	$('.request_button').live("click",(function() {
		var contact_name = $("input[name=contact_name]").val();
		var contact_phone = $("input[name=contact_phone]").val();
		var contact_email = $("input[name=contact_email]").val();
		var call_time=$('#call_time').val();
		var services = new Array();
		$("input[@name='services[]']:checked").each(function() {services.push($(this).val());});


		if(!$.trim(contact_name)){
			
			alert("Please provide us with your name");
			return false;
			
			}
		if(!$.trim(contact_email)){
			
			alert("Please provide us with your email address");
			return false;
			
			}
		if(!$.trim(contact_phone)){
			
			alert("Please provide us with your contact telephone number");
			return false;
			
			}
			
		if (services.length == 0) {
			
			alert("Please select at least one service");
			return false;
			
			}
			
		
		
		$('#form_container').fadeOut("slow",function(){
			
			$('#loading').fadeIn("slow",function(){
				
								
					var data = 'do=send&contact_name='+contact_name+'&contact_phone='+contact_phone+'&call_time='+call_time+'&services='+services.join('|');
					
									
					$.ajax({

						url: "ajax_code.php",	
						type: "POST",
						data: data,		
						
						cache: false,
						
					
						success: function () {				
																					
							$('#loading').fadeOut("slow",function(){
								
								$(".thanks").fadeIn("slow");
								
								});
														
							}		
					});	
					
			
					
				  	return false;
				  	
	  	
					
					
				});
				
			});
		
	return false;	
	  		
	}));






});
		

