/*********************************************************
 * LOGIN AND PASSWORDS
 *********************************************************/

function cbk_doLogin(errors) {
	doing_ajax = false;
	if (!errors) {
		//window.location=URL+"smartlogin.php";
                parent.location.href = URL+"smartlogin.php";
	} else {
		$("#callback-login").html(errors);
	}
}

/*********************************************************
 * USER
 *********************************************************/
function cbk_doSignUp(errors) {
	doing_ajax = false;

	if (!errors) {
		window.location=URL+"sign-up-done.php";
	} else {
		$("#callback-signup").html(errors);
		$("#callback-signup").fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
	}
}

function cbk_doUpdatePassword(errors) {
	doing_ajax = false;
	if (!errors) {
		$("#callback-password").html("<p class='Ok'>&raquo; Password updated!</p>");
		$("#old_password").val("");
		$("#new_password").val("");
		var methodDashboard = "window.location='"+URL_CPANEL+"dashboard';";
		setTimeout(methodDashboard, 500);
	} else {
		$("#callback-password").html(errors);
	}
		$("#callback-password").fadeOut(100).fadeIn(100);
}

function cbk_doUpdateProfile(errors) {
	doing_ajax = false;
	if (!errors) {
		$("#callback-profile").html("<p class='Ok'>&raquo; Profile updated!</p>");
		var methodDashboard = "window.location='"+URL_CPANEL+"dashboard';";
		setTimeout(methodDashboard, 500);
		//history.go(0);
	} else {
		$("#callback-profile").html(errors);
	}
		$("#callback-profile").fadeOut(100).fadeIn(100);
}

/*********************************************************
 * ISSUING
 *********************************************************/
function cbk_sendGift(errors) {
	doing_ajax = false;
	if (!errors) {
		history.go(0);
	} else {
		$("#callback").html(errors);
		$("#callback").fadeOut(100).fadeIn(100);
	}
}

/*********************************************************
 * CREDIT CARD
 *********************************************************/
function cbk_doAddCreditCard(errors) {
	doing_ajax = false;
	if (!errors) {
		history.go(0);
	} else {
		$("#callback-addcreditcard").html(errors);
		$("#callback-addcreditcard").fadeOut(100).fadeIn(100);
	}
}



function cbk_doAddFunds(errors) {
	doing_ajax = false;
	if (!errors) {
		history.go(0);
	} else {
		$("#callback-addfunds").html(errors);
		$("#callback-addfunds").fadeOut(100).fadeIn(100);
	}
}

function cbk_doDeleteCard(errors,card_id) {
	doing_ajax = false;
	if (!errors) {
		history.go(0);
	} else {
		$("#callback-deletecard"+card_id).html(errors);
		$("#callback-deletecard"+card_id).fadeOut(100).fadeIn(100);
	}
}

function cbk_doAddAutomaticRecharge(errors) {
	doing_ajax = false;
	if (!errors) {
		$("#callback").html("<p class='Ok'>&raquo; Auto Recharge successfully added!</p>");
		history.go(0);
	} else {
		$("#callback").html(errors);
		$("#callback").fadeOut(100).fadeIn(100);
	}

}

/*********************************************************
 * CELLPHONE
 *********************************************************/

function cbk_doAddCellphone(errors) {
	doing_ajax = false;
	if (!errors) {
		$("#callback").html("<p class='Ok'>&raquo; Mobile Number added!</p>");
		var methodDashboard = "window.location='"+URL_CPANEL+"profile#cellphone';";
		setTimeout(methodDashboard, 500);
		//history.go(0);
	} else {
		$("#callback").html(errors);
		$("#callback").fadeOut(100).fadeIn(100);
	}
}

 function cbk_doValidateCellphone(errors) {
	doing_ajax = false;
	if (!errors) {
		$("#callback-pending").html("<p class='Ok'>&raquo; Validation ok!</p>");
		var methodDashboard = "window.location='"+URL_CPANEL+"dashboard#cellphone';";
		setTimeout(methodDashboard, 500);
	} else {
		$("#callback-pending").html(errors);
		$("#callback-pending").fadeOut(100).fadeIn(100);
	}

}