/*************************

BYLAZ PURPLE BAG AJAX FUNCTIONS
AJAX.PHP EM /PHP :d

*******************************************/

function inclui_bd( table, campo, value){
	var resultado = $.ajax({type: "POST", url: dir+"php/ajax.php", data: "table="+table+"&campo="+campo+"&value="+value+"&ac=inserir",async: false}).responseText;
    return resultado;
}
function atualiza_bd( table, campo, value, where ){
	var resultado = $.ajax({type: "POST",url: dir+"php/ajax.php",data: "table="+table+"&campo="+campo+"&value="+value+"&ac=atualiza&where="+where, async: false}).responseText;
    return resultado;
}
function num_rows( table, campo, value, where_campo, where_value ){
	var resultado = $.ajax({type: "POST",url: dir+"php/ajax.php",data: "table="+table+"&campo="+campo+"&value="+value+"&ac=num_rows&where_campo="+where_campo+"&where_value="+where_value, async: false}).responseText;
    return resultado;
}
function get_value( table, campo, where_campo, where_value ){
	var resultado = $.ajax({type: "POST",url: dir+"php/ajax.php",data: "table="+table+"&campo="+campo+"&ac=get_value&where_campo="+where_campo+"&where_value="+where_value, async: false}).responseText;
    return resultado;
}
function query_db( query ){
	var resultado = $.ajax({type: "POST",url: dir+"php/ajax.php",data: "ac=query_db&query="+query, async: false}).responseText;
	return resultado;
}
function ajax_function( f_name, params ){
	var str_params = "";
	for( x = 0; x < params.length; x++ )
		str_params += "&param["+x+"]="+addslashes(params[x]);
	var resultado = $.ajax({type: "POST", url: dir+"php/ajax.php", data: "ac="+f_name+str_params,async: false}).responseText;
    return resultado;
}