$(function()
	{
		if(showq == "no")
		{
			showQuestions('');
			
		}else
		{
		
		}
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR PRODUCT PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn').click(function()
		{
			var counter = 0;
			
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo; j++)
			{
				ansArray.push($("input[@name=q"+j+"]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('The questions you have just answered indicates that you need a custom cable.', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myCustom;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				showQuestions('');
			}
		}); //question btn
		
		$('#skipBtn').click(function()
		{
			showQuestions('');
		}); //skip btn
	


		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB CLUTCH PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_clutch').click(function()
		{
			var counter = 0;
			
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_clutch; j++)
			{
				ansArray.push($("input[@name=q"+j+"_clutch]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Clutch Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_clutch;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				clutchable = "true";
				showQuestions('_clutch');
			}
		}); //questionbtn
		
		$('#skipBtn_clutch').click(function()
		{
			clutchable = "true";
			showQuestions('_clutch');
		}); //skip btn
	


		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB THROTTLE PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_throttle').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_throttle; j++)
			{
				ansArray.push($("input[@name=q"+j+"_throttle]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Throttle Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_throttle;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				throttleable = "true";
				showQuestions('_throttle');
			}
		}); //questionbtn
		
		$('#skipBtn_throttle').click(function()
		{
			throttleable = "true";
			showQuestions('_throttle');
		}); //skip btn
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB IDLE PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_idle').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_idle; j++)
			{
				ansArray.push($("input[@name=q"+j+"_idle]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Idle Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_idle;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				idleable = "true";
				showQuestions('_idle');
			}
		}); //questionbtn
		
		$('#skipBtn_idle').click(function()
		{
			idleable = "true";
			showQuestions('_idle');
		}); //skip btn
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB DESUPPER PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_desupper').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_desupper; j++)
			{
				ansArray.push($("input[@name=q"+j+"_desupper]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Designer Upper Assembly Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_desupper;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				desupperable = "true";
				showQuestions('_desupper');
			}
		}); //questionbtn
		
		$('#skipBtn_desupper').click(function()
		{
			desupperable = "true";
			showQuestions('_desupper');
		}); //skip btn


		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB DESUPPER ABS PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_desupper_abs').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_desupper_abs; j++)
			{
				ansArray.push($("input[@name=q"+j+"_desupper_abs]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Designer Upper Assembly Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_desupper;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				desupperabsable = "true";
				showQuestions('_desupper_abs');
			}
		}); //questionbtn
		
		$('#skipBtn_desupper_abs').click(function()
		{
			desupperabsable = "true";
			showQuestions('_desupper_abs');
		
		}); //skip btn

		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB SINGLEDISK PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_singledisk').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_singledisk; j++)
			{
				ansArray.push($("input[@name=q"+j+"_singledisk]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Front Single Disc Brake Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_singledisk;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				singlediskable = "true";
				showQuestions('_singledisk');
			}
		}); //questionbtn
		
		$('#skipBtn_singledisk').click(function()
		{
			singlediskable = "true";
			showQuestions('_singledisk');
		}); //skip btn
		
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB SWIVELFIT PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_swivelfit').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_swivelfit; j++)
			{
				ansArray.push($("input[@name=q"+j+"_swivelfit]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Swivel Fit Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_swivelfit;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				swivelfitable = "true";
				showQuestions('_swivelfit');
			}
		}); //questionbtn
		
		$('#skipBtn_swivelfit').click(function()
		{
			swivelfitable = "true";
			showQuestions('_swivelfit');
		}); //skip btn
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB REARBRAKE PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_rearbrake').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_rearbrake; j++)
			{
				ansArray.push($("input[@name=q"+j+"_rearbrake]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Rear Brake Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_rearbrake;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				rearbrakeable = "true";
				showQuestions('_rearbrake');
			}
		}); //questionbtn
		
		$('#skipBtn_rearbrake').click(function()
		{
			rearbrakeable = "true";
			showQuestions('_rearbrake');
		}); //skip btn
		
		//////////////////////////////////////////////////////////////////////////////////////
		//FOR SBB IGNITION WIRES PAGE/////////////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////////////////////////
		$('#questionsBtn_ignitionwires').click(function()
		{
			var counter = 0;
			//console.log("asdf");
			var ansArray = new Array();
			
			for(var j = 1; j <= qNo_ignitionwires; j++)
			{
				ansArray.push($("input[@name=q"+j+"_ignitionwires]:checked").val());
			}
			
			//Check fo
			for(var i = 0; i < ansArray.length;i++)
			{
				////console.log(ansArray[i]);
				if(ansArray[i])
				{
					if(ansArray[i] == "yes")
					{
						jAlert('You will now be directed to the Ignition Wires Product Page', 'Alert Dialog', function()
						{
							////console.log(myCustom);
							window.location = myProduct_ignitionwires;
						});
						break;
					} else
					{
						counter++;
						
					}
				}else
				{
					jAlert('Please answer all questions please.', 'Alert Dialog');


					break;
				}
			}
			
			if(counter == ansArray.length)
			{
				ignitionwiresable = "true";
				showQuestions('_ignitionwires');
			}
		}); //questionbtn
		
		$('#skipBtn_ignitionwires').click(function()
		{
			ignitionwiresable = "true";
			showQuestions('_ignitionwires');
			
			clutchable = "true";
			    
			    	
		}); //skip btn
	

	}); //function
	function showQuestions(obj)
	{
		//console.log("yay");
		purchaseable = "true";
		$('.submitBtn'+obj).animate({opacity:1});
		$('#questionsArea'+obj).fadeOut();
		
	}
	function showAll()
	{
		clutchable = "true";
		showQuestions('_clutch');
		
		throttleable = "true";
		showQuestions('_throttle');
		
		idleable = "true";
		showQuestions('_idle');
		
		desupperable = "true";
		showQuestions('_desupper');
		
		singlediskable = "true";
		showQuestions('_singledisk');
		
		swivelfitable = "true";
		showQuestions('_swivelfit');
		
		rearbrakeable = "true";
		showQuestions('_rearbrake');
		
		ignitionwiresable = "true";
		showQuestions('_ignitionwires');
	}
	
