/**
* @author: Fernando BARETTO & Carlos Miguel FARIAS & Javier Alvarez
* @category: ajax
* @copyright: it_soluciones
* @desc: maneja solicitudes cdsr.
* @filesource: cargador.js
* @license: Concejo Deliberante Municipalidad Santa Rosa
* @package: js
* @subpackage: gestion ajax
* @version: 0.21.21 - 07/01/2011 11:27:50
*/

/*	constantes */
var K = {
	B1D : "salida_1_solo_datos",
	B1DN : "#salida_1_solo_datos",
	B1S : "salida_1_solo",
	BOL : "boolean",
	BSA : "salida_busqueda",
	BSQ : "busqueda",
	CI : "CI",
	DLG : "#dialogo",
	FST: "fast",
	NRO : "number",
	OBJ : "objeto",
	ROK : "success",
	SRA : "Sr/a. Usuario/a...",
	STR : "string",
	UND : "undefined"
};

var gaArchivos = new Array();
var gaPila = new Array();
var gcModulo = '';
var giCategorias = 0;
var giObjeto = 0;
var giTemas = 0;
var giTipolegislacion = 0;
var glAviLgl = true;
var glAviNav = true;
var glEsMSExplorer = $.browser.msie;
var glHayGrilla = false;

/**
* Ajusta Altura de Un elemento indicado
* @param string	tcQue ( nombre elemento a ajustar )
* @param integer	tiAltMin ( alto minimo )
* @param integer	tiAltMax ( alto maximo )
* @return void
*/
function Ajuste_Altura( tcQue, tiAltMin, tiAltMax ) {
	var liAltAct = document.getElementById( tcQue ).style.height;
	var liB = 0;
	var liAlto = 0;
	if ( typeof( tiAltMin )!=K.UND ) liB = tiAltMin;
	if ( typeof( tiAltMax )!=K.UND ) liA = tiAltMax;
	if ( liB>0 && liAltAct<liB ) document.getElementById( tcQue ).style.height = liB;
	if ( liA>0 && liAltAct>liA ) document.getElementById( tcQue ).style.height = liA;
}

/**
* Toma para mostrar un objeto del sistema
* @param string tcGrl ( nombre grilla desde donde se hace la solicitud )
* @param integer tiRow ( fila desde donde se hace la solicitud )
* @return void
*/
function Alzar( tcGrl, tiRow ) {
	var la = jQuery( "#" + tcGrl ).jqGrid('getRowData',tiRow );
	Procesar( K.BSQ, K.OBJ, la.idObjeto );
	Mostrar( K.B1S );
	Ocultar( K.BSA );
}

/**
* Carga en pila de objetos el objeto que se visualiza cuando pasa a otro
* @param integer	tvId ( id objeto a apilar )
* @param string	tcMdl ( nombre modulo que se procesa )
* @return void
*/
function Apilar( tvId, tcMdl ) {
	var la = new Array( 0, '' );
	if ( tvId==0 ) {
		gaPila = new Array();
	} else {
		if ( tvId<0 ) {
			if ( gaPila.length>1 ) {
				la = gaPila.pop();
				la = gaPila.pop();
			} else {
				gaPila = new Array();
			};
		} else {
			la[0] = tvId;
			la[1] = tcMdl;
			gaPila.push( la );
		};
	};
	giObjeto = la[0];
	gcModulo = la[1];
}

/**
* Armando. Carga Respueta Formato JSON donde se indique como destino
* @param string tcJSONtxt ( texto JSON a distribuir )
* @return void
*/
function Armando( tcJSONtxt ){
	try {
		var la = JSON.parse( tcJSONtxt );
	} catch( e ) {
		try {
			var la = eval( '(' + tcJSONtxt + ')' );
			/*
			if ( glAviNav ) {
			CuadroMensaje( '<br /><b>Su Navegador <b>"' + $.browser.version +
			'"</b> no soporta algunas funcionalidades de navegabilidad de este sitio...</b><br /><br />Muchas de las caracteristicas de accesibilidad facilitada no estar&aacute;n disponibles<br /><br /><br /><i>Sepa Disculpar las molestias</i>...<br /><br />&nbsp;',
			'Sr/a. Usuario/a...', true, 600, 400, 'W' );
			glAviNav = false;
			}
			*/
		} catch( e ) {
			var lcJSONtxt = jQuery.trim( tcJSONtxt );
			CuadroMensaje( '<br /><b>Falla en la Conexi&oacute;n, por favor, reintente...</b><br />',
			K.SRA, true, 600, 400, 'E' );
//			CuadroMensaje( lcJSONtxt, K.SRA, true, 800, 800, 'E' );
			return;
		}
	}
	$.each( la.contenidos,
	function( i, contenido ) {
		if ( contenido.destino=='bitacora' ) {
		} else {
			if ( contenido.destino=='cuadro_mensajes' ) {
				var liA = ( Math.round( contenido.html.length/40 )*20 )+120;
				CuadroMensaje( contenido.html, K.SRA, true, 500, liA, 'E' );
				//Mostrar( 'mensajes' );
				return;
			};
			$( '#' + contenido.destino ).html( contenido.html );
			/* Agregar aqui manejo de CSS y JSCRIPT */
			if ( contenido.destino==K.BSA ) {
				if ( contenido.html.length>11 ) {
					glHayGrilla = true;
					Mostrar( K.BSA );
					Ocultar( K.B1S );
					$( '#salida_busqueda' ).show();
				} else Ocultar( K.BSA );
			};
			if ( contenido.destino==K.B1D ) {
				Ajuste_Altura( K.B1D, 400, 800 );
				Mostrar( K.B1S );
			};
		}
	}
	);
	Avisar();
}

/**
* Manda o borra aviso amarillo esquina superior izquierda
* @param string	tcMsg ( mensaje a mostrar, agrega ... parapdeantes, si vacio, oculta mensaje ).
* @return void
*/
function Avisar( tcMsg ) {
	if ( typeof( tcMsg )==K.STR && tcMsg.length>0 ) {
		$( "#mensajes_proceso" ).html( tcMsg + '<blink>...</blink>' );
		Mostrar( "mensajes_proceso" );
	} else Ocultar( "mensajes_proceso" );
}

/**
* Muestra aviso legal sobre el Digesto
* @return void
*/
function AvsLgl() {
	glAviLgl = false;
	var lc =
	"<p style='font-size: 12px'><i><b>NOTA INTRODUCTORIA.-</b></i></p>" +
	"<div style='width:770px;text-align: justify; font-size: 11px; font-family: verdana; text-indent: 3%;'>" +
	"<p>Desde que en el a&ntilde;o 1983 el Honorable Concejo Deliberante de la ciudad de Santa Rosa encomendara la confecci&oacute;n del Digesto Municipal, se han sucedido tres ediciones del mismo.- La primera en dos tomos de soporte papel, la segunda y la tercera en soporte magn&eacute;tico o CD.ROM.-</p>" +
	"<p>En el a&ntilde;o 2003. su contenido fu&eacute; volcado a la creada p&aacute;gina WEB del H. Concejo Deliberante, posibilitando con ello el acceso a miles de potenciales usuarios y asimismo la actualizaci&oacute;n permanente y pr&aacute;cticamente instant&aacute;nea.-</p>" +
	"<p>No obstante, los criterios que gobernaron su estructuraci&oacute;n originaria, contin&uacute;an vigentes y reiterar la descripci&oacute;n contenida en su primera edici&oacute;n, resulta &uacute;til para facilitar su consulta y comprender la importancia de la obra.-</p>" +
	"<p>Desde el punto de vista legislativo, el Digesto Municipal es diferente a un C&oacute;digo Municipal. El primero contiene la publicaci&oacute;n de las ordenanzas, resoluciones y disposiciones comunales, transcriptas seg&uacute;n diferentes criterios de ordenamiento (por temas, por a&ntilde;o, por n&uacute;mero), elimin&aacute;ndose los textos derogados o carentes de inter&eacute;s general. Las normas inclu&iacute;das, derivan su vigencia del acto original de sanci&oacute;n, ya que el Digesto no es en s&iacute; otra norma legal sino una recopilaci&oacute;n ordenada de textos ya aprobados.-</p>" +
	"<p>Un C&oacute;digo Municipal, en cambio, es un texto &uacute;nico y colectivo que en diversos cap&iacute;tulos regula todo el quehacer municipal. Su sanci&oacute;n y promulgaci&oacute;n borra toda la legislaci&oacute;n municipal anterior, no existiendo en lo sucesivo sino su solo y &uacute;nico texto.</p>" +
	"<p>Como se dijo, el presente encuadra dentro del primer concepto, y su prop&oacute;sito sigue consistiendo en contar en un solo cuerpo, con la legislaci&oacute;n municipal vigente en el municipio de Santa Rosa, dictada desde la provincializaci&oacute;n de La Pampa en junio de 1953 hasta la actualidad, dado que la incorporaci&oacute;n de las nuevas normas es pr&aacute;cticamente inmediata.-</p>" +
	"<div style='text-indent: 0%;'><ol type='1'>" +
	"<li>Se incluyen las ordenanzas, resoluciones y disposiciones dictadas por Departamento Deliberativo y las resoluciones del Departamento Ejecutivo, con los atributos de generalidad o impersonalidad, estabilidad en cuanto a su permanencia en el tiempo y obligatoriedad para todos a quienes se dirigen. En consecuencia no se incluyen normas de alcance individual o particular, como ser&iacute;an por ejemplo eximiendo de grav&aacute;men a una persona, otorgando un subsidio o aceptando una renuncia.-</li><br />" +
	"<li>Las normas legales seleccionadas fueron agrupadas en secciones siguiendo un criterio tem&aacute;tico. V&eacute;ase al respecto el &iacute;ndice tem&aacute;tico. Dentro de cada secci&oacute;n o tema, las diferentes normas se encuentran agrupadas de la siguiente manera:<br /><br />" +
	"<ol type='a'>" +
	"<li>Por la fuente normativa, es decir primero las ordenanzas y luego resoluciones, etc., salvo que las resoluciones sean reglamentarias del Departamento Ejecutivo, caso en el cual figuran a continuaci&oacute;n de la Ordenanza a la cual reglamentan.-</li><br />" +
	"<li>Si la fuente es de igual jerarqu&iacute;a, se ordenan por fecha de su vigencia, comenzando por las m&aacute;s antiguas.-</li><br />" +
	"<li>Es importante destacar que las modificaciones parciales integran sin excepci&oacute;n la norma modificada, con lo cual se cuenta as&iacute;, con el texto ordenado y actualizado de todas las normas inclu&iacute;das en el Digesto.-</li><br />" +
	"li>Se incorporan igualmente leyes y/o decretos provinciales a los cuales ha adherido la Municipalidad de Santa Rosa, toda vez en su virtud, el texto pasa a integrar el cuerpo normativo municipal. Por excepci&oacute;n, no se han incluido ciertas partes del C&oacute;digo Alimentario Nacional y del C&oacute;digo de Edificaci&oacute;n de la ciudad de Buenos Aires debido a la imprecisi&oacute;n en las normas de adhesi&oacute;n.-</li><br />" +
	"<li>Los restantes criterios de b&uacute;squeda se especifican en la Ayuda en l&iacute;nea con que cuenta el sitio.-</li><br />" +
	"</ol></li>" +
	"<li>Desde la primera edici&oacute;n, se han eliminado los textos derogados en en forma expresa o impl&iacute;cita, lo cual oblig&oacute; y sigue obligando a una cuidadosa compulsa de toda la normativa municipal. Lo expuesto implica reiterar que de ning&uacute;n modo est&aacute; definitivamente exclu&iacute;da la posibilidad de que se haya omitido una norma vigente o por el contrario se haya inclu&iacute;do alguna cuya vigencia pueda ser cuestionada, en todo o en parte. Ello se debe a las derogaciones impl&iacute;citas, que son numerosas y que en ciertos casos introducen dudas sobre los verdaderos alcances modificatorios o derogatorios de normas municipales por tal motivo. En todo caso, ante la duda, se ha optado por la inclusi&oacute;n, dejando a la labor de los int&eacute;rpretes el pronunciamiento definitivo sobre el particular.-</li>" +
	"</ol></p><p>Para conclu&iacute;r, debe reiterarse que el Digesto Municipal no habr&iacute;a podido realizarse ni actualizarse, sin el apoyo de las autoridades del Concejo que se han sucedido a lo largo de los diferentes per&iacute;odos y sin el compromiso constante del agente categor&iacute;a 3. Sr. Jorge Esp&oacute;sito.-</p>" +
	"<p>Dr. Luis Omar Nu&ntilde;ez<br />" +
	"Asesor Jur&iacute;dico H. C. D.<br />" +
	"Octubre de 2006.-</p></div>";
	CuadroMensaje( lc, 'DIGESTO C.D.S.R. (LP).-', true, 880, 500, 'I' );
}

/**
* Cierra la salida a datos de uno y vuelve a la grilla.
* @param variant	tvGrl
*/
function Cerrar( tvGrl ) {
	Avisar( 'Cerrando' );
	Ocultar( K.B1S );
	$( "#salida_1_solo_titulo" ).html( '' );
	$( K.B1DN ).html( '' );
	/** @todo manejo pila de grillas */
	if ( typeof( tvGrl )==K.BOL && tvGrl ) {
		$( '#txtBusqueda' ).val( $( '#txtBusqueda1' ).val() );
		Minimiza( K.BSA );
		glHayGrilla = false;
		$( "#salida_busqueda").html( '' );
	}
	Apilar( 0 );
	if ( glHayGrilla ) Mostrar( K.BSA );
	Avisar();
}

/**
* Completa Imagenes en la grilla
* @param string	tcGrl ( nombre de la grilla a completar )
* @return void
*/
function Copar( tcGrl ) {
	Avisar( 'Completando Imagenes' );
	var tcGrl = "#" + tcGrl;
	var ids = jQuery( tcGrl ).jqGrid('getDataIDs');
	for( var i=0; i < ids.length; i++ )
		{
		var la = jQuery( tcGrl ).jqGrid('getRowData',ids[i] );
		var lc = "<img src=\"./imagenes/" + la.mImagen + "\" /><br />" + la.cCategoria;
		jQuery( tcGrl ).jqGrid('setRowData',ids[i],{imgCategoria:lc});
	};
	Avisar();
}

/**
* Envia un cuadro de dialogo con una imagen
* @param string	tcImg ( nombre de la imagen )
* @param string	tcTtl ( Titulo del cuadro de dialogo )
* @return void
*/
function CuadroImagen( tcImg, tcTtl ) {
	if ( typeof( tcImg )!=K.STR ) tcImg = 'zzz_no_especificado.png';
	if ( typeof( tcTtl )!=K.STR ) tcTtl = 'Imagen Ampliada...';
	var lc = '<div align="center" style="width: auto; display: block; vertical-align: middle;">' +
	'<img id="imgCuadroImagen" src="'+ tcImg +'" /></div>' +
	"<br /><p align='right' style='font-size: 9px; font-weight:bold'>Clic en la (X) del T&iacute;tulo o pulse Tecla &lt;ESC&gt; para cerrar esta ventana</p>";
	'</div></div>';
	$( K.DLG ).html( lc );
	$( document ).ready( function() {
		$( K.DLG ).
		dialog( { autoOpen: true, title: tcTtl, height: 432, width: 490, modal: true } );
	} );
}

/**
* Envia un cuadro de mensaje con imagen apropiada
* @param string	tcImg ( nombre de la imagen )
* @param string	tcTtl ( Titulo del cuadro de dialogo )
* @param boolean	tcMdl ( Modal o no )
* @param integer	tiAnc ( Ancho del cuadro )
* @param integer	tiAlt ( Alto del cuadro )
* @param string	tcImg ( tipo imagen )
* @return void
*/
function CuadroMensaje( tcMsg, tcTtl, tlMdl, tiAnc, tiAlt, tcImg ) {
	if ( typeof( tcMsg )!=K.STR || tcMsg.length==0 ) {
		$( K.DLG ).html( '' );
		$( K.DLG ).dialog( 'close' );
		return;
	};
	if ( typeof( tcTtl )!=K.STR || tcTtl.length==0 ) tcTtl = 'ATENCI&Oacute;N!';
	if ( typeof( tlMdl )!=K.BOL ) tlMdl = true;
	if ( typeof( tiAnc )==K.UND ) tiAnc = 400;
	if ( typeof( tiAlt )==K.UND ) tiAlt = 180;
	var lcImagen = 'zzz_info.png';
	var lcAlter = 'INFO';
	if ( tcImg=='W' ) {
		lcImagen = 'zzz_no_especificado.png';
		lcAlter = 'ATENCION';
	}
	else if ( tcImg=='E' ) {
		lcImagen = 'zzz_error.png';
		lcAlter = 'ERROR';
	};
	tiAlt = tiAlt + 40;
	tcMsg = '<div>' +
	'<div align="right" style="width: 72px; display: table-cell; vertical-align: middle;">'+
	'<img src="./imagenes/imagenes_seleccionadas/48x48/'+lcImagen+'" alt="[ '+lcAlter+' ]" />'+
	'</div>'+
	'<div style="display: table-cell; vertical-align: middle; padding-left: 9px">'+
	tcMsg + "<br /><p align='right' style='font-size: 9px; font-weight:bold'>Clic en la (X) del T&iacute;tulo o pulse Tecla &lt;ESC&gt; para cerrar esta ventana</p>" +
	'</div></div>';
	$( K.DLG ).html( tcMsg );
	$( K.DLG ).dialog( {
		autoOpen: true,
		title: tcTtl,
		height: tiAlt,
		width: tiAnc,
		modal: tlMdl
	} );
}

/**
* Valida la existencia de la variable
* @param string tcVariable (nombre de la variable)
* @return logical
*/
function existe( tcVariable ) {
	try {
		if( typeof( eval( tcVariable ) )!=K.UND ){
			if( eval( tcVariable )!= null ){
				return true;
			}
		}
	} catch(e) { }
	return false;
}

/**
* Quita blancos iniciales y finales y dobles blancos internos
* @param string tc ( cadena a lavar )
* @return string ( cadena lavada )
*/
function Lavar( tc ) {
	tc = $.trim( tc );
	var er = /  /g;
	while ( tc.indexOf( '  ' )>=0 ) {
		tc = tc.replace( er, ' ' );
	};
	return tc;
}

/**
* Maximiza. Maximiza Despacio.
* @param string tcQue (id del elemento html)
* @return VOID
**/
function Maximiza( tcQue ) {
	$( '#' + tcQue ).show( K.FST );
}

/**
* Minimiza. Minimiza Despacio.
* @param string tcQue (id del elemento html)
* @return VOID
**/
function Minimiza( tcQue ) {
	$( '#' + tcQue ).hide( K.FST );
}

/**
* Mostrar. Pasa a visible.
* @param string tcQue (id del elemento html)
* @return VOID
**/
function Mostrar( tcQue, tvTop ) {
	if ( typeof( tvTop )!=K.UND ) Mover( tcQue, tvTop );
	$( "#" + tcQue ).css( {'visibility' : 'visible'} );
	$( 'html, body' ).animate( { scrollTop: 0 }, K.FST );
}

/**
* Mueve un elemento a otro lado (altura)
* @param string	tcQue (nombre item)
* @param variant	tvTop (adonde va)
*/
function Mover( tcQue, tvTop ) {
	switch ( typeof( tvTop ) ) {
		case K.UND:
			tvTop = -1;
			break;
		/** @todo: Mover al tope de un elemento ya posicionado.
		case K.STR:
		try {
		tvTop = $( '#' + tvTop ).css( 'top' );
		} catch ( e ) {
		tvTop = - 1
		};
		break;
		*/
		case K.NRO:
			break;
		default:
			tvTop = -1;
	};
	if ( tvTop>=0 ) {
		var lcTop = tvTop + 'px';
		$( '#' + tcQue ).animate( { "top" : lcTop }, 'slow' );
	};
}

/**
* Ocultar. Pasa a oculto.
* @param string tcQue (id del elemento html)
* @return VOID
**/
function Ocultar( tcQue ) {
	$( "#" + tcQue ).css( {'visibility' : 'hidden'} );
}

/**
* Poner.
* @param string tcQue (cadena del elemento html)
* @return VOID
**/
function Poner( tcQue, tvTop ) {
	if ( typeof( tvTop )==K.UND ) TvTop = 1;
	$( K.B1DN ).html( tcQue );
	Mostrar( K.B1S, tvTop );
}
/**
* Procesar. Invoca a un Modulo asincronico, con un id
* @param string tcMdl ( Modulo a invocar )
* @param variant tvId ( identificador a pasar )
* @return void
**/
function Procesar( tcMdl, tcAcc, tvId, tcQue, tcAbr ){
	if ( typeof( tcAbr )!=K.UND ) {
		var lcVnt = tcMdl+"_"+tcAcc;
		var lcFrm = '';
		switch ( tcAbr ) {
			case 1:
				tvId = $( '#thdId' ).val();
				lcFrm = 'width=800,Top=64,Left=64,scrollbars=1,resizable=1,directories=0,location=0,menubar=1,status=0,titlebar=0,toolbar=0';
				window.open(
					"index.php?thdModulo=busqueda&thdAccion="+tcAcc+"&thdId="+tvId,
					lcVnt,
					lcFrm );
				return;
				break;
			case 2:
				tvId = $( '#thdId' ).val()
				lcFrm = 'Width=888,Height=888,Top=64,Left=64,Scrollbars=NO,Resizable=YES,Directories=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO';
				window.open( "pdf.php?x=" + tvId, lcVnt, lcFrm );
				return;
				break;
			case 3:			// Se usa en AUDIO SESIONES y REUNIONES
				lcFrm = 'Width=470,Height=510,Top=99,Left=99,Scrollbars=YES,Resizable=YES,Directories=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO';
				window.open( tcQue, lcVnt, lcFrm );
				return;
				break;
			case 4:
				lcFrm = 'Width=434,Height=560,Top=128,Left=128,Scrollbars=YES,Resizable=YES,Directories=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO';
				window.open( "./zzz_ejemplos/jplayer_v1.2.0/demo-02-oggSupportFalse.htm", lcVnt, lcFrm );
				return;
				break;
			case 5:			// Se usa en PRESUPUESTOS
				lcFrm = 'Width=1024,Height=768,Top=20,Left=10,Scrollbars=YES,Resizable=YES,Directories=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO';
				window.open( tcQue, lcVnt, lcFrm );
				return;
				break;
			default:
				lcFrm = '';
		};
		window.open( "index.php?x=" + tcQue, lcVnt, lcFrm );
		return;
	};
	var lcMsg = '';
	if ( ( tcMdl=='lateral_derecho' ||
	tcMdl=='menu_principal' ||
	tcMdl=='menu_secundario' ) && tcAcc!=K.CI ) {
		var lc = tcAcc.replace( '_', ' ' );
		lcMsg = lc.toUpperCase();
	} else if ( tcAcc!=K.CI ) {
		lcMsg = tcMdl.toUpperCase();
	};
	$( "#thdModulo" ).val( tcMdl );
	$( "#thdAccion" ).val( tcAcc );
	if ( typeof( tcAcc )==K.STR && tcAcc==K.OBJ ) {
		Apilar( tvId, tcMdl );
	} else Avisar( 'Procesando <b>' + lcMsg + '</b>' );
	$( "#thdId" ).val( tvId );
	$( "#x" ).val( tcQue );
	$( "#thdAncho" ).val( $( '#principal' ).width() );
	var lcPrm = $( '#original' ).serialize();
	$.post(	"index.php", lcPrm,
	function( tcRsp, tcEst ){
		if( tcEst==K.ROK ){
			Armando( tcRsp );
			if ( tcMdl==K.BSQ && tcAcc=='avanzada' && tvId!=K.CI ||
			tcMdl=='digesto' && tcAcc=='form' && tvId!=K.CI ) {
				MaxMinCriterios();
			};
		} else {
			CuadroMensaje( 'Respuesta erronea: ' + tcEst,
			'Error Conexi&ón al Servidor',
			true, 400, 200, 'E' );
		};
		Avisar();
	}
	)
}

/**
* @deprecated
*/
function Refrescar() {
	var liObj = giObjeto;
	var lcMdl = gcModulo;
	Apilar( -1 );
	Procesar( lcMdl, K.OBJ, liObj );
}

/**
* Recarga Objeto Anterior
*/
function Retroceder( ) {
	Apilar( -1 );
	if ( giObjeto==0 ) {
		Cerrar();
	}
	else {
		Procesar( gcModulo, K.OBJ, giObjeto );
	};
}

// Evento al final de la carga del Html
$( document ).ready( function() {
	Procesar( 'pie', K.CI, 0 );
	Procesar( K.BSQ, K.CI, 0 );
	Procesar( 'cabecera', K.CI, 0 );
	Procesar( 'menu_principal', K.CI, 0 );
	Procesar( 'menu_secundario', K.CI, 0 );
	Procesar( 'noticias_imagenes', K.CI, 0 );
	Procesar( 'lateral_derecho', K.CI, 0 );
	Procesar( 'noticias_destacadas', K.CI, 0 );
});

jQuery.getCSS = function( url, media ) {
	jQuery( document.createElement('link') ).attr({
		href: url,
		media: media || 'screen',
		type: 'text/css',
		rel: 'stylesheet'
	}).appendTo('head');
};
