function get_major(mnd,pid)
{
	var data="st=major_details&degree_id="+mnd;
	//alert(data);
	jQuery.ajax({
			url: 'include/ajax1.php',
			type: "POST",
			cache: false,
			data: data,
			success: function (res) {
				//alert(res);
				var res1=res.split('~');
				html='<option value="">Choose Major</option>';
				for(i=1;i<res1.length;i++)
				{
					var ress=res1[i].split('=');
					html+="<option value="+ress[0]+">"+ress[1]+"</option>";
				}
				$('#major_id').html(html);
				$('#major_id').val(pid);
			}
		});
}

function add_to_cart(id,status,action)
{
	var data="st=add_to_cart&course_id="+id+"&child_id="+status+"&action="+action;
	jQuery.ajax({
		url: 'include/ajax1.php',
		type: "POST",
		cache: false,
		data: data,
		success: function (res) {
			//alert(res);
			var res1 = res.split('~');

			for(i=1; i<res1.length; i++)
			{
				var ress = res1[i].split('=');

				toggle_cart(id,ress[0]);
				jQuery("#cartModal").addClass("active");

				// update cart count
				if(ress[0] == 'count')
				{
					jQuery("#cart_count").text(ress[1]);
				}
			}
			cart_count(status);
			// auto hide popup
			setTimeout(function(){
				jQuery("#cartModal").removeClass("active");
			}, 2000);
		}
	});
}

function cart_count(id)
{
	var data="st=get_card_count&log_id="+id;
	jQuery.ajax({
		url: 'include/ajax1.php',
		type: "POST",
		cache: false,
		data: data,
		success: function (res) {
		
			var res1 = res.split('~');
			//alert(res)
			$('.gactive').html(res1);
			
		}
	});
}

function toggle_cart(id,add)
{
	//alert(id+"  "+add);
	if(add==1)
	{
		$('.cart_main_add'+id).hide();
		$('.cart_main_remove'+id).show();
	}
	else
	{
		$('.cart_main_add'+id).show();
		$('.cart_main_remove'+id).hide();
	}
}