// JavaScript Document

	document.write('<script type="text/javascript" language="javascript" src="librerias/js/jquery.js"></script>');
	document.write('<script type="text/javascript" language="javascript" src="librerias/js/jquery.min.js"></script>');
	document.write('<script type="text/javascript" language="javascript" src="librerias/js/jquery.flash.js"></script>');
	document.write('<script type="text/javascript" language="javascript" src="librerias/js/scroll_noticias.js"></script>');
	
// CONJUNTO DE VARIABLES Y CONSTANTES PARA LA MANIPULACIÓN DE LA PAGINA WEB
	var cargador = '<img title="Cargador" src="imagenes/gif/cargador.gif" />&nbsp;&nbsp;';


// FUNCIÓN QUE PERMINE LA ENTRADA A LA PAGINA WEB
	function entrar(){
		if ($("div.msg").is(":hidden")) {
			// Despliego el contenedor para mostrar que se esta procediendo a cargar una informacion
			$("div.msg").slideDown("slow", function(){
				// Doy el aviso de que se esta cargando la informacion
				$("div.msg").html(cargador+'Cargando la Sección Solicitada');
				$("div.datos_a").hide("slow", function(){
					$("div.banner_a").fadeOut("slow", function(){
						// cargo en el contenedor la informacion
						$('div.datos_a').load('secciones/nosotros_1.php', function(){
							cargar_flash('banner_a', 'flash/banner_nos1', '100%', '95px');
							$('div.datos_a').show("slow", function(){
								$("div.menu").hide("slow", function(){
									//Se procede a mostrar los enlaces principales
									$('.derecha').fadeIn('slow', function(){
										$("div.banner_a").fadeIn("slow", function(){
											$('.enlace1').fadeIn('slow', function(){
												$('.enlace2').fadeIn('slow', function(){
													$('.enlace3').fadeIn('slow', function(){
														$('.enlace4').fadeIn('slow', function(){
															$('.enlace5').fadeIn('slow', function(){
																// cargo en el contenedor la informacion
																$('div.menu').load('secciones/menu_nosotros.php', function(){
																	$('div.menu').show("slow", function(){
																		$('div.datos_a').animate({ scrollTop: 'Top'}, "slow" , function(){	
																			$('div.menu').animate({ scrollLeft: 'Left'}, "slow" , function(){
																				// Procedo a ocultar el contenedor luego de finalizar la carga de la informacion
																				$("div.msg").slideUp("slow", function(){
																					// limpio el contenedor para que no consuma recursos
																					$("div.msg").html('');
																					$('.ab_centro').css('padding-left', '12px');
																					$('.ab_centro').css('padding-top', '30px');
																					//$('.ab_derecha').css('padding-left', '75px');
																					$('.ab_centro').html('<div align="center"><a href="#" onclick="cargar_contenido(\'ayuda_1.php\', \'datos_a\', \'\', \'menu_ayuda.php\')"><img src="imagenes/png/Icon017.png" height="64px" title="Bienvenidos" /></a><br />Bienvenidos</div>');
																					
																				});
																			});
																		});
																	});
																});
															});
														});
													});
												});
											});
										});
									});
								});	
							});
						});
					});
				});
			});
		}
	}
	
// FUNCIÓN QUE PERMITE CARGAR DINAMICAMENTE EL CONTENIDO DE UNA PAGINA WEB EN UN CONTENEDOR
	
	function cargar_contenido(url, cont, xxx, op){
		// Verifico que se haya este oculto el contenedor, por lo que la informacion ya se habra cargado
		if ($("div.msg").is(":hidden")) {
			if(op.length  > 5){
				// Despliego el contenedor para mostrar que se esta procediendo a cargar una informacion
				$("div.msg").slideDown("slow", function(){
					// Doy el aviso de que se esta cargando la informacion
					$("div.msg").html(cargador+'Cargando la Sección Solicitada');
					$("div.banner_a").fadeOut("slow", function(){
						$("div."+cont).fadeOut("slow", function(){
							cargar_flash('banner_a', 'flash/banner_'+op.substr(5,3)+'1', '100%', '95px');
							$("div."+cont).html('Ceproca, C.A.');
							// cargo en el contenedor la informacion
							$('div.'+cont).load('secciones/'+url, {parametros:xxx}, function(){
								$("div.menu").fadeOut("slow", function(){
									$("div.menu").html('Ceproca, C.A.');
									$('div.menu').load('secciones/'+op, {parametros:xxx}, function(){
										if(url.substr(0,8) == 'noticias'){
											qm_create(0,true,0,0,'all',false,false,false,false);	
										}
										$('div.banner_a').fadeIn("slow", function(){
											$('div.'+cont).fadeIn("slow", function(){
												$('div.menu').fadeIn("slow", function(){
													$('div.datos_a').animate({ scrollTop: 'Top'}, "slow" , function(){	
														$('div.menu').animate({ scrollLeft: 'Left'}, "slow" , function(){
															// Procedo a ocultar el contenedor luego de finalizar la carga de la informacion
															$("div.msg").slideUp("slow", function(){
																// limpio el contenedor para que no consuma recursos
																$("div.msg").html('');
																//transprente();
															});
														});
													});
												});
											});
										});
									});
								});
							});
						});
					});
				});
			}else{
				// Despliego el contenedor para mostrar que se esta procediendo a cargar una informacion
				$("div.msg").slideDown("slow", function(){
					// Doy el aviso de que se esta cargando la informacion
					$("div.msg").html(cargador+'Cargando la Sección Solicitada');
					$('.current').removeClass("current");
					$('.'+op).addClass("current");
					$("div.banner_a").fadeOut("slow", function(){
						$("div."+cont).fadeOut("slow", function(){
							cargar_flash('banner_a', 'flash/banner_'+op, '100%', '95px');
							$("div."+cont).html('Ceproca, C.A.');
							// cargo en el contenedor la informacion
							$('div.'+cont).load('secciones/'+url, {parametros:xxx}, function(){	
								if(url.substr(0,8) == 'noticias'){
									qm_create(0,true,0,0,'all',false,false,false,false);	
								}
								$('div.banner_a').fadeIn("slow", function(){
									$('div.'+cont).fadeIn("slow", function(){
										$('div.datos_a').animate({ scrollTop: 'Top'}, "slow" , function(){	
											
											// Procedo a ocultar el contenedor luego de finalizar la carga de la informacion
											$("div.msg").slideUp("slow", function(){
												// limpio el contenedor para que no consuma recursos
												$("div.msg").html('');
												//transprente();
											});
										});
									});
								});
							});
						});
					});
				});
			}
		}else{
			alert('Por Favor Espere, Estamos Procesando su petición anterior');	
		}
	}
	
// FUNCION QUE ACOMODA LAS TRANSPARENCIAS DE LOS PNG
	function transprente(){
		var arVersion = navigator.appVersion.split("MSIE")
		var version = parseFloat(arVersion[1])
		
		if ((version < 7) && (document.body.filters)){
			for(var i=0; i<document.images.length; i++){
				var img = document.images[i]
			  	var imgName = img.src.toUpperCase()
			  	if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
				 	var imgID = (img.id) ? "id='" + img.id + "' " : ""
				 	var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				 	var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				 	var imgStyle = "display:inline-block;" + img.style.cssText 
				 	if (img.align == "left") imgStyle = "float:left;" + imgStyle
				 	if (img.align == "right") imgStyle = "float:right;" + imgStyle
				 	if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				 	var strNewHTML = "<span " + imgID + imgClass + imgTitle
				 	+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				 	+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				 	+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				 	img.outerHTML = strNewHTML
				 	i = i-1
			  	}
			}
			alert("Le participamos que su versión del browser es obsoleta, por lo que la empresa le invita a actualizar a una versión más nueva de su browser, de lo contrario no podrá visualizar correctamente nuestro portal web. Gracias.");
		}
	}
	
	function cargar_flash(contenedor, url, ancho, alto){
		$('.'+contenedor).html('');
		$('.'+contenedor).flash(
		{
			src: url+'.swf',
			width: ancho,
			height: alto,
			wmode: 'transparent', 
			scale: 'exactfit',
			play: 'true',
			loop: 'true',
			quality: 'high'
		},
		{ 
			expressInstall: true 
		});
					
	}
	
	function poptastic(url, titulo){
		var width = '800';
		var height = '600';
		var top = (screen.height-height)/2;
		var left = (screen.width-width)/2;
		var newwindow = window.open(url,titulo,'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + 'toolbar=false, location=false, ,resizable=false,scrollbars=false, status=false');
		if (window.focus) {
				newwindow.focus();
		}
	}
