$(document).ready(function() {	
	var tvid = 0;
	var cvid = 0;
	//Condition JS
	$(".condition-item").hover(function(){
		$(this).addClass('green');
		},function(){
		if(!$(this).hasClass('sel-green'))
		{
			$(this).removeClass('green');
		}
	});

	$(".condition-item").click(function(){
		$(".condition-item").removeClass('green');
		$(".condition-item").removeClass('sel-green');

		$(this).addClass('green');
		$(this).addClass('sel-green');
		tvid = jQuery("input", this).val();
		//alert(jQuery("input", this).val());
	});
	
	//Course JS	
	$(".course-item").hover(function(){
		$(this).addClass('green');
		},function(){
		if(!$(this).hasClass('sel-course-green'))
		{
			$(this).removeClass('green');
		}
	});

	$(".course-item").click(function(){
		$(".course-item").removeClass('green');
		$(".course-item").removeClass('sel-course-green');

		$(this).addClass('green');
		$(this).addClass('sel-course-green');
		cvid = jQuery("input", this).val();
		//alert(jQuery("input", this).val());
	});
	
	//Submit button
	$("#submit-filter").click(function(){
		if(tvid == 5 && cvid == 6){//DIABETES
			window.location = base_path + 'recipes/diabetes/breakfast';
		}else if(tvid == 5 && cvid == 7){
			window.location = base_path + 'recipes/diabetes/maincourse-veg';
		}else if(tvid == 5 && cvid == 8){
			window.location = base_path + 'recipes/diabetes/maincourse-nonveg';
		}else if(tvid == 5 && cvid == 9){
			window.location = base_path + 'recipes/diabetes/salads';
		}else if(tvid == 5 && cvid == 10){
			window.location = base_path + 'recipes/diabetes/snacks';
		}else if(tvid == 5 && cvid == 11){
			window.location = base_path + 'recipes/diabetes/beverage';
		}else if(tvid == 5 && cvid == 12){
			window.location = base_path + 'recipes/diabetes/dessert';
		}else if(tvid == 4 && cvid == 6){//EATING RIGHT
			window.location = base_path + 'recipes/eating-right/breakfast';
		}else if(tvid == 4 && cvid == 7){
			window.location = base_path + 'recipes/eating-right/maincourse-veg';
		}else if(tvid == 4 && cvid == 8){
			window.location = base_path + 'recipes/eating-right/maincourse-nonveg';
		}else if(tvid == 4 && cvid == 9){
			window.location = base_path + 'recipes/eating-right/salads';
		}else if(tvid == 4 && cvid == 10){
			window.location = base_path + 'recipes/eating-right/snacks';
		}else if(tvid == 4 && cvid == 11){
			window.location = base_path + 'recipes/eating-right/beverage';
		}else if(tvid == 4 && cvid == 12){
			window.location = base_path + 'recipes/eating-right/dessert';
		}else if(tvid == 3 && cvid == 6){//CHOLESTEROL - HEART
			window.location = base_path + 'recipes/heart/breakfast';
		}else if(tvid == 3 && cvid == 7){
			window.location = base_path + 'recipes/heart/maincourse-veg';
		}else if(tvid == 3 && cvid == 8){
			window.location = base_path + 'recipes/heart/maincourse-nonveg';
		}else if(tvid == 3 && cvid == 9){
			window.location = base_path + 'recipes/heart/salads';
		}else if(tvid == 3 && cvid == 10){
			window.location = base_path + 'recipes/heart/snacks';
		}else if(tvid == 3 && cvid == 11){
			window.location = base_path + 'recipes/heart/beverage';
		}else if(tvid == 3 && cvid == 12){
			window.location = base_path + 'recipes/heart/dessert';
		}else if(tvid == 2 && cvid == 6){//HYPERTENSION
			window.location = base_path + 'recipes/hypertension/breakfast';
		}else if(tvid == 2 && cvid == 7){
			window.location = base_path + 'recipes/hypertension/maincourse-veg';
		}else if(tvid == 2 && cvid == 8){
			window.location = base_path + 'recipes/hypertension/maincourse-nonveg';
		}else if(tvid == 2 && cvid == 9){
			window.location = base_path + 'recipes/hypertension/salads';
		}else if(tvid == 2 && cvid == 10){
			window.location = base_path + 'recipes/hypertension/snacks';
		}else if(tvid == 2 && cvid == 11){
			window.location = base_path + 'recipes/hypertension/beverage';
		}else if(tvid == 2 && cvid == 12){
			window.location = base_path + 'recipes/hypertension/dessert';
		}else if(tvid == 1 && cvid == 6){//OBESITY
			window.location = base_path + 'recipes/obesity/breakfast';
		}else if(tvid == 1 && cvid == 7){
			window.location = base_path + 'recipes/obesity/maincourse-veg';
		}else if(tvid == 1 && cvid == 8){
			window.location = base_path + 'recipes/obesity/maincourse-nonveg';
		}else if(tvid == 1 && cvid == 9){
			window.location = base_path + 'recipes/obesity/salads';
		}else if(tvid == 1 && cvid == 10){
			window.location = base_path + 'recipes/obesity/snacks';
		}else if(tvid == 1 && cvid == 11){
			window.location = base_path + 'recipes/obesity/beverage';
		}else if(tvid == 1 && cvid == 12){
			window.location = base_path + 'recipes/obesity/dessert';
		}else if(tvid <= 0 && cvid == 6){//MEAL COURSES ONLY
			window.location = base_path + 'recipes/breakfast';
		}else if(tvid <= 0 && cvid == 7){
			window.location = base_path + 'recipes/maincourse-veg';
		}else if(tvid <= 0 && cvid == 8){
			window.location = base_path + 'recipes/maincourse-nonveg';
		}else if(tvid <= 0 && cvid == 9){
			window.location = base_path + 'recipes/salads';
		}else if(tvid <= 0 && cvid == 10){
			window.location = base_path + 'recipes/snacks';
		}else if(tvid <= 0 && cvid == 11){
			window.location = base_path + 'recipes/beverage';
		}else if(tvid <= 0 && cvid == 12){
			window.location = base_path + 'recipes/dessert';
		}else if(tvid <= 1 && cvid == 0){//CONDITION TYPE ONLY
			window.location = base_path + 'node/74';
		}else if(tvid <= 2 && cvid <= 0){
			window.location = base_path + 'node/73';
		}else if(tvid <= 3 && cvid <= 0){
			window.location = base_path + 'node/71';
		}else if(tvid <= 4 && cvid <= 0){
			window.location = base_path + 'node/75';
		}else if(tvid <= 5 && cvid <= 0){
			window.location = base_path + 'node/72';
		}
		//window.location = base_path + 'recipes/' + tvid + '&cvid=' + cvid;
	});
});
