function changePlan() {
	
	var radioObj = document.forms['plan_form'].elements['plan'];
	var radioLength = radioObj.length;
	
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			var plan = radioObj[i].value;
		}
	}


	$.post("/admin/account/upgrade", {plan: plan}, function() {
            $('#mainContent').load("/admin/account/viewpage", {}, function() {$("#flashMessage").show("normal",
        function()
        {
            $("#flashMessage").fadeOut(10000);
        });
        });
		});
        
}

// function hideErrorText() {
// 	document.getElementById('errorText').innerHTML = '';
// }

function setToday(){
	
	var today=new Date()
	
	var thisyear= today.getFullYear()
	var thismonth = today.getMonth() + 1;
	var thismonth = (thismonth < 10) ? "0" + thismonth : thismonth;
	var thisday = (today.getDate() < 10) ? "0" + today.getDate() : today.getDate();
	
	$("#lab_year").val(thisyear).attr("selected", "selected");
	$("#lab_month").val(thismonth).attr("selected", "selected");
	$("#lab_day").val(thisday).attr("selected", "selected");
	
	$("#lab_year_end").val(thisyear).attr("selected", "selected");
	$("#lab_month_end").val(thismonth).attr("selected", "selected");
	$("#lab_day_end").val(thisday).attr("selected", "selected");
}

function courseDrops() {

    var valore = $("#first_select").val();
    $.ajax({
           url: "/dropdown/prova",
           global: false,
           type: "POST",
           async: false,
           dataType: "html",
           data: "first_select="+ valore, //the name of the $_POST variable and its value
           success: function (response) //'response' is the output provided by the controller method prova()
                       {
                       //counts the number of dynamically generated options
                       var dynamic_options = $("*").index( $('.dynamic_skill')[0] );
                    //removes previously dynamically generated options if they exists (not equal to 0)
                       if ( dynamic_options != (-1)) $(".dynamic_skill").remove();
                    $("#second_select").append(response);
                    $(".first").attr({selected: ' selected'});
                   }
          });
          return false
}

function dateDrops() {

    var valore = $("#lab_month").val();
    $.ajax({
           url: "/dropdown/nova",
           global: false,
           type: "POST",
           async: false,
           dataType: "html",
           data: "lab_month="+ valore, //the name of the $_POST variable and its value
           success: function (response) //'response' is the output provided by the controller method prova()
                       {
                       //counts the number of dynamically generated options
                       var dynamic_options = $("*").index( $('.dynamic')[0] );
                    //removes previously dynamically generated options if they exists (not equal to 0)
                       if ( dynamic_options != (-1)) $(".dynamic").remove();
                    $("#lab_day").append(response);
                    $(".first").attr({selected: ' selected'});
                   }
          });
          return false
}

function dateDropsEnd() {

    var valore = $("#lab_month_end").val();
    $.ajax({
           url: "/dropdown/bova",
           global: false,
           type: "POST",
           async: false,
           dataType: "html",
           data: "lab_month_end="+ valore, //the name of the $_POST variable and its value
           success: function (response) //'response' is the output provided by the controller method prova()
                       {
                       //counts the number of dynamically generated options
                       var dynamic_options = $("*").index( $('.dynamicE')[0] );
                    //removes previously dynamically generated options if they exists (not equal to 0)
                       if ( dynamic_options != (-1)) $(".dynamicE").remove();
                    $("#lab_day_end").append(response);
                    $(".first").attr({selected: ' selected'});
                   }
          });
          return false
}
