/*
 Operaciones para los campos del form
*/
// al recibir el foco
function formFields() {
	$('input, textarea, select').css('border', '1px solid #ccc');
	$('input, textarea, select').focus(function(){
		$(this).css('border', '1px solid #76aed9');
	});
	
	// al perder el foco
	$('input, textarea, select').blur(function(){
		$(this).css('border', '1px solid #ccc');
	});
}


/*
 * REdimensionar los campos seleccionados al hacer onfoucs segun ID
 */
 function redimField (field) {
 	$(field).css('width','70%');
 	$(field).focus(function(){
		$(this).css('width','90%');
	});
    $(field).blur(function(){
        $(this).css('width','70%');
    });
 }
 
 
/* **************************************************************** */
/*
	RequestThis 
	Solicita mediante ajax los parametros s= seccion,
	c=controlador, q=parametro a buscar
*/
   
function requestThis(s, c, q){
   $('#dLoad').load("index.php?dox="+s+"&c="+c+"Controller&q="+q)
}



// Ventana Popup
function popup(url) {
	var popventana;
	
	popventana = window.open(url,'name','height=400,width=450');
	if (window.focus) {popventana.focus()}
}

// 

 
 /**
*
*  Scrollable HTML table plugin for jQuery
*  http://www.webtoolkit.info/
*
**/

jQuery.fn.Scrollable = function(tableHeight, tableWidth) {
	this.each(function(){
		if (jQuery.browser.msie || jQuery.browser.mozilla) {
			var table = new ScrollableTable(this, tableHeight, tableWidth);
		}
	});
};

/*
 * FUNCIONES DE EDICION, RETORNO, ELIMINAR por AJAX
 */

function ajaxFormActions(action, pag, id){
	
	// RETORNAR
	if (action == "retornar") $('.ajaxRequest').load('index.php?dox=cpanel&c='+pag+'&r=1');
	
	// EDITAR
	if ((action == "edit") && (id != ""))
		$('#log').load('index.php?dox=cpanel&c='+pag+'&edit=1&id='+id);

	// ELIMINAR
	if ((action == "drop") && (id != ""))
		if (confirm('Esta seguro que desea eliminar este registro?')){ 
	   	$('#registros').load('index.php?dox=cpanel&c='+pag+'&drop=1&id='+id);
	  }

}
