var carrusel;
var stackPage = [];
var listaVideos;
var cicloAcc;
var since_id=0;

listaVideos = [{
   tipo : 0, 
	tituloVideo: 'Ingenier&iacute;a en Tecnolog&iacute;as de Informaci&oacute;n y Telecomunicaciones',
	descrip : '',
	linkPag: 'http://www.iest.edu.mx/academia/programas/tampico/profesional/itit/itit_promo.php',
	abrir: 1,
	urlInterno : "http://sie.iest.edu.mx/app/videos/itit/ITIT_IEST.flv",
	urlExterno : "http://www.youtube.com/v/GTjP7EVrS2A&hl=es&fs=1",
	urlImgVideo : 'http://www.iest.edu.mx/includes/images/ITIT_1.jpg',
	imgBarra : 'http://www.iest.edu.mx/includes/images/ITIT_1.jpg',
	autoPlay: false 
},{
	tipo : 0, 
	tituloVideo: 'Licenciatura en Idiomas',
	descrip : '',
	linkPag: 'http://www.iest.edu.mx/academia/programas/tampico/profesional/li/li_promo.php',
	abrir: 1,
	urlInterno : "http://sie.iest.edu.mx/app/videos/Li/LI__IEST.flv",
	urlExterno : "http://www.youtube.com/v/vHZHRAzZmwY&hl=es&fs=1",
	urlImgVideo : 'http://www.iest.edu.mx/includes/images/LI_1.jpg',
	imgBarra : 'http://www.iest.edu.mx/includes/images/LI_1.jpg',
	autoPlay: false 
},{
	tipo : 1, 
	tituloVideo: 'J&oacute;venes con Valor',
	descrip : '',
	linkPag: 'iest/fasal/jv/jv.php',
	abrir: 0,
	urlInterno : "http://www.iest.edu.mx/iest/alumnado/fasal/jv/images/jovenesconvalor2007.swf",
	urlExterno : "http://www.iest.edu.mx/iest/alumnado/fasal/jv/images/jovenesconvalor2007.swf",
	urlImgVideo : 'http://www.iest.edu.mx/includes/images/JV_1.jpg',
	imgBarra : 'http://www.iest.edu.mx/includes/images/JV_1.jpg',
	autoPlay: false 
},{
	tipo : 0, 
	tituloVideo: 'Conoce Tamaulipas',
	descrip : '',
	linkPag: 'perfiles/visitantes.php',
	abrir: 0,
	urlInterno : "http://sie.iest.edu.mx/app/videos/tamaulipas/tamaulipas.flv",// cambiar url por el correcto
	urlExterno : "http://www.youtube.com/v/Hz-2b2jLIoA&hl=es&fs=1",
	urlImgVideo : 'http://www.iest.edu.mx/includes/images/Tamaulipas_1.jpg',
	imgBarra : 'http://www.iest.edu.mx/includes/images/Tamaulipas_1.jpg',
	autoPlay: false 
}];




(function($) {

$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		
		// Fix pageX, pageY, clientX and clientY for mozilla
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
	
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		
		$(this).unbind('mousemove.mousewheel');
		
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		
		$.removeData(this, 'mwcursorposdata');
	},
	
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		
		event = $.event.fix(event || window.event);
		// Get correct pageX, pageY, clientX and clientY for mozilla
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
//		if ( $.browser.opera  ) delta = -event.wheelDelta;
		
		event.data  = event.data || {};
		event.type  = "mousewheel";
		
		// Add delta to the front of the arguments
		args.unshift(delta);
		// Add event to the front of the arguments
		args.unshift(event);

		return $.event.handle.apply(this, args);
	}
};

$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

})(jQuery);

/*$.ui.dialog.defaults.bgiframe = true;*/
var acc=null;
var indexAccordion=0;

function cargaSitio(vinculo){
	var cantidad;
	if (acc != undefined){
		clearInterval(cicloAcc);
		$("#acordion").accordion('destroy');
	}
	switch($(vinculo).attr('abrir')){
		case '0':
			if ($(vinculo).attr('sitio') != ''){
				if ($(vinculo).attr('back') != 1){
					cantidad = stackPage.length - 1;
					page = stackPage[cantidad];
					stackPage.push ($(vinculo).attr('sitio'));
					$('#contenidoSitio').load($(vinculo).attr('sitio'), function(){
						if (stackPage.length != 0 ){
							$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						}else{
							initWWW();
						}
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
				}else{
					pageBack = stackPage.pop();
					cantidad = stackPage.length-1;
					page = stackPage[cantidad];
					$('#contenidoSitio').load(page, function(){
						if ((stackPage.length - 1) != 0 ){
							$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						}else{
							initWWW();
						}
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
				}
			}
			break;
		case '1':
			winExterno = window.open($(vinculo).attr('sitio'),"sistema","scrollbars=yes,resizable=yes,width=1000,height=600");
			winExterno.focus();
			break;
		case '2':
			winExterno = window.location = $(vinculo).attr('sitio');
			break;	
		default:
			if ($(vinculo).attr('sitio') != ''){
				if ($(vinculo).attr('back') != 1){
					cantidad = stackPage.length - 1;
					page = stackPage[cantidad];
					stackPage.push ($(vinculo).attr('sitio'));
					$('#contenidoSitio').load($(vinculo).attr('sitio'), function(){
						if (stackPage.length != 0 ){
							$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						}else{
							initWWW();
						}
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
				}else{
					pageBack = stackPage.pop();
					cantidad = stackPage.length-1;
					page = stackPage[cantidad];
					$('#contenidoSitio').load(page, function(){
						if ((stackPage.length - 1) != 0 ){
							$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						}else{
							initWWW();
						}
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
				}
			}
			break;
	}
}

/*function cargaSitio2(vinculo){
	var cantidad;
	if (acc != undefined){
		clearInterval(cicloAcc);
		$("#acordion").accordion('destroy');
	}
	if ($(vinculo).attr('sitio') != ''){
		if ($(vinculo).attr('back') != 1){
			cantidad = stackPage.length - 1;
			page = stackPage[cantidad];
			stackPage.push ($(vinculo).attr('sitio'));
			$('#contenidoSitio').load($(vinculo).attr('sitio'), function(){
				if (stackPage.length != 0 ){
					$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
				}else{
					initWWW();
				}
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}else{
			pageBack = stackPage.pop();
			cantidad = stackPage.length-1;
			page = stackPage[cantidad];
			$('#contenidoSitio').load(page, function(){
				if ((stackPage.length - 1) != 0 ){
					$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
				}else{
					initWWW();
				}
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}
	}
}*/

function abreOpcion(opcion){
	idMenu = $(opcion).attr('idMenu');
	if ($(opcion).attr('paginaWeb') == ''){
		if ($('#conte-' + idMenu).css('display') == 'none'){
			$('#conte-' + idMenu).slideDown('fast', function (){
				//$('#scrollMenuOpcion').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
				//$('#scrollMenuOpcion').css('width', '220px');
				//$('#menuLateral .jScrollPaneContainer').css('border','none');
				altoCont= $('#menuLateral').height()+$('#informes').height();
				//alert('si '+altoCont);
				$('#cont .jScrollPaneContainer:first').css('height',altoCont+'px');
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});					
				$('#cont .jScrollPaneContainer').css('border','none');
			});
			
		}else{
			$('#conte-' + idMenu).slideUp('fast', function(){
				//$('#scrollMenuOpcion').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
				//$('#scrollMenuOpcion').css('width', '220px');
				//$('#menuLateral .jScrollPaneContainer').css('border','none');
				altoCont= $('#menuLateral').height()+$('#informes').height();
				//alert('si '+altoCont);
				$('#cont .jScrollPaneContainer:first').css('height',altoCont+'px');
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});		
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}
	}else if ($(opcion).attr('paginaWeb') != ''){
		//carrusel.destroy();
		
		if ($(opcion).attr('principal') != 1){
			switch($(opcion).attr('abrir')){
				case '0':  // se abre en contenidositio!
					clearInterval(cicloAcc);
					if(carrusel){
						carrusel.destroy();						
					}
					//carrusel.destroy();
					$('#contenidoSitio').load($(opcion).attr('paginaWeb'), function(){
						stackPage = ['inicio/inicio.php'];
						cantidad = stackPage.length;
						page = stackPage[cantidad];
						$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						stackPage.push ($(opcion).attr('paginaWeb'));
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
					break;
				case '1':  // se abre en ventana aparte.
				    altoVentana = "600";
					if ($(opcion).attr('altoVentana')!=""){
						altoVentana = $(opcion).attr('altoVentana');
						}
					winExterno = window.open($(opcion).attr('paginaWeb'),"sistema","scrollbars=yes,resizable=yes,width=1000,height="+altoVentana);
					winExterno.focus();
					break;
				case '2':   // se abre en toda la ventana.
					clearInterval(cicloAcc);
					if(carrusel){
						carrusel.destroy();						
					}
					//carrusel.destroy();
					winExterno = window.location = $(opcion).attr('paginaWeb');
					break;
				default:
					clearInterval(cicloAcc);
					if(carrusel){
						carrusel.destroy();						
					}
					//carrusel.destroy();
					$('#contenidoSitio').load($(opcion).attr('paginaWeb'), function(){
						stackPage = ['inicio/inicio.php'];
						cantidad = stackPage.length;
						page = stackPage[cantidad];
						$('#tdBack').prepend('<span> [ <a style="cursor:pointer;" onClick="cargaSitio(this)" sitio="' + page + '" back="1">Regresar</a> ] </span>');
						stackPage.push ($(opcion).attr('paginaWeb'));
						$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
						$('#cont .jScrollPaneContainer').css('border','none');
					});
					break;
			}
		}else{
			if (acc != undefined){
				clearInterval(cicloAcc);
				$("#acordion").accordion('destroy');
			}
			if(carrusel){
				carrusel.destroy();						
			}
			$('#contenidoSitio').load($(opcion).attr('paginaWeb'), function(){
				initWWW();
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}
	}
}

// ****************************************************************************************************

// EXAIEST BENEFICIOS

function abreOpcionBeneficios(opcion){
	idBene = $(opcion).attr('idBene');
	if ($(opcion).attr('paginaWeb') == ''){
		if ($('#conteBene-' + idBene).css('display') == 'none'){
			$('#conteBene-' + idBene).slideDown('fast', function (){
				//$('#scrollMenuOpcion').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
				//$('#scrollMenuOpcion').css('width', '220px');
				//$('#menuLateral .jScrollPaneContainer').css('border','none');
				altoCont= $('#menuLateral').height()+$('#informes').height();
				//alert('si '+altoCont);
				$('#cont .jScrollPaneContainer:first').css('height',altoCont+'px');
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});					
				$('#cont .jScrollPaneContainer').css('border','none');
			});
			
		}else{
			$('#conteBene-' + idBene).slideUp('fast', function(){
				//$('#scrollMenuOpcion').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
				//$('#scrollMenuOpcion').css('width', '220px');
				//$('#menuLateral .jScrollPaneContainer').css('border','none');
				altoCont= $('#menuLateral').height()+$('#informes').height();
				//alert('si '+altoCont);
				$('#cont .jScrollPaneContainer:first').css('height',altoCont+'px');
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});		
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}
	}
	
	
}
function abreBeneficio(obj){
      elBeneficio=window.open(obj.href, obj.target, 'width=920,height=650,scrollbars=yes'); 
      return false;
}
// ****************************************************************************************************



function initVideo(){
	interno = $("#dondeEstoy").val(); //1 Interno, 0 Externo.
	if (interno == 1 && listaVideos[0].tipo == 0){
		video = flowplayer("player", "http://sie.iest.edu.mx/app/videos/flowplayer/flowplayer-3.0.7.swf", {
			clip: { title: listaVideos[0].tituloVideo,
					buffering : true},
			play: { opacity: 0.8, 
					label: "Clic para visualizar", 
					replayLabel: 'Reproducir otra vez', 
					fadeSpeed: 500,         
					rotateSpeed: 50 },
			playlist: [ listaVideos[0].urlImgVideo, {url: listaVideos[0].urlInterno, autoPlay: listaVideos[0].autoPlay}]
		});
	}else if (interno == 0 && listaVideos[0].tipo == 0){
		$("#player > *").remove();
		$("#player").append('<object width="320" height="260"><param name="movie" value="' + listaVideos[0].urlExterno + '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="' + listaVideos[0].urlExterno + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="260"></embed></object>');
	}else if (listaVideos[0].tipo == 1){
		$("#player > *").remove();
		$("#player").append('<object height="150" id="objFlash" width="275" title=" " codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="fbanner3"><param value="images/jovenesconvalor2007.swf" name="movie"/><param value="high" name="quality"/><param value="false" name="menu"/><embed height="150" width="275" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="' + listaVideos[0].urlInterno + '"/></object>');
	}
	
	$('#tituloVideo').html('<a abrir="'+listaVideos[0].abrir+'" paginaweb="'+listaVideos[0].linkPag+'" onclick="abreOpcion(this)" style="cursor: pointer;">'+listaVideos[0].tituloVideo+'</a>');
	$('#descripVideo').html(listaVideos[0].descrip);
	
	$("#videosImgsUl > *").remove();
	$.each(listaVideos, function (index, obj){
		$("#videosImgsUl").append('<li onclick="showVideo(' + index + ',' + interno + ');"><img height="82" width="98" style="margin-top:4px;" src="' + obj.imgBarra + '"/></li>');	
	});
					
	if($('#videosImgs li').length<4){			
		width=$('#videosImgs li').length*109;//124	
	}else{
		width=3*109;   //124
	}	
	widthUl=$("#videosImgs ul > li").length*109;
	jQuery('#videosImgsUl').jcarousel({
		visible:3,
		scroll: 1,
		animation:500,
		initCallback: function (carousel, state){
			jQuery('#mycarousel-next').bind('click', function() {
				carousel.next();
				return false;
			});
				
			jQuery('#mycarousel-prev').bind('click', function() {
				carousel.prev();
				return false;
			});
			
			carousel.buttonNext.bind('click', function() {
			});	
		},
		itemFirstInCallback: function (carousel, item, idx, state){
			return false;
		},
		itemVisibleInCallback: function (carousel, item, idx, state) {
			jQuery('img', item).fadeIn('fast');				
		},
		itemVisibleOutCallback : function (carousel, item, idx, state) {
			jQuery('img', item).fadeOut('fast');
		}
	});
	$('#videosImgs .jcarousel-container-horizontal').css("width",width);
	$('#videosImgs .jcarousel-clip-horizontal').css("width",width);
	$('#videosImgs .jcarousel-clip-horizontal').css("margin-left","0px");
	$('#videosImgs .jcarousel-list-horizontal').css("width",widthUl);
	$('#videosImgs .jcarousel-item').css("width","109px");
	width=null;
	widthUl=null;
}

function showVideo(index, interno){
	  if (interno == 1 && listaVideos[index].tipo == 0){   //acceso dentro del campus.
		video = flowplayer("player", "http://sie.iest.edu.mx/app/videos/flowplayer/flowplayer-3.0.7.swf", {
			clip: { title: listaVideos[index].tituloVideo,
					buffering : true},
			play: { opacity: 0.8, 
					label: "Clic para visualizar", 
					replayLabel: 'Reproducir otra vez', 
					fadeSpeed: 500,         
					rotateSpeed: 50 },
			playlist: [ listaVideos[index].urlImgVideo, {url: listaVideos[index].urlInterno, autoPlay: listaVideos[0].autoPlay}]
		});
	}else if (interno == 0 && listaVideos[index].tipo == 0){   //fuera del campus
		$("#player > *").remove();
		$("#player").append('<object width="320" height="260"><param name="movie" value="' + listaVideos[index].urlExterno + '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="' + listaVideos[index].urlExterno + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="260"></embed></object>');
	}else if (listaVideos[index].tipo == 1){  // objeto swf!!!! :D
		$("#player > *").remove();
		$("#player").append('<object height="150" width="275" title=" " codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="fbanner3"><param value="images/jovenesconvalor2007.swf" name="movie"/><param value="high" name="quality"/><param value="false" name="menu"/><embed height="150" width="275" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="' + listaVideos[index].urlInterno + '"/></object>');
	}
	$('#tituloVideo').html('<a abrir="'+listaVideos[index].abrir+'" paginaweb="'+listaVideos[index].linkPag+'" onclick="abreOpcion(this)" style="cursor: pointer;">'+listaVideos[index].tituloVideo+'</a>');
	$('#descripVideo').html(listaVideos[index].descrip);
}

function fotoNoticia(idPic, idNot){   // Funcion que muestra la foto en grande en el dialog....
	$('#contNoticia').html(""); 
	$('#contNoticia').html('<table  height="100%" width="100%"><tr valign="bottom"><td><div align="center"><img src="includes/images/spinner.gif" alt="Espere"/></div></td></tr><tr valign="top"><td><div align="center">Cargando...</div></td></tr></table>');
	$.ajax({
			type: "GET",
			url: "portalAcciones.php",
			data: "accion=6&idPic="+idPic+"&id="+idNot,
			success: function(responseMsg){
				//alert(responseMsg);
				$('#contNoticia').hide();
				$('#contNoticia').html(responseMsg).fadeIn('slow');
				idPic=null;
				idNot=null;
			},
			error: function(msg){
				alert(msg);
			}
		});
}

function contNoticia(id){
	$('#contNoticia').html(""); 
	$('#contNoticia').html('<table  height="100%" width="100%"><tr valign="bottom"><td><div align="center"><img src="includes/images/spinner.gif" alt="Espere"/></div></td></tr><tr valign="top"><td><div align="center">Cargando...</div></td></tr></table>');
	$.ajax({
			type: "GET",
			url: "portalAcciones.php",
			data: "accion=7&id="+id,
			success: function(responseMsg){
				//alert(responseMsg);
				$('#contNoticia').hide();
				$('#contNoticia').html(responseMsg);
				$('#contNoticia').show();
				id=null;
				//$('#contNoticia').html(responseMsg).fadeIn('slow');
			},
			error: function(msg){
				alert(msg);
			}
		});
}

function showNoticia(id){
	
		// Primero limpio el titulo y el contenido del dialog.. y se muestra el spinner de "Cargando"
		$('#dialogNot').dialog('option', 'title', "");
		$('#dialogNot').html(""); 
		$("#dialogNot").html('<table  height="105" width="100%"><tr valign="bottom"><td><div align="center"><img src="includes/images/spinner3.gif" alt="Espere"/></div></td></tr><tr valign="top"><td><div align="center">Cargando...</div></td></tr></table>');
		
		//se hace una consulta mediante ajax para obtener el titulo de la noticia con respecto al id y se coloca en el titulo del dialog
		$.ajax({
			type: "GET",
			url: "portalAcciones.php",
			data: "accion=4&id="+id,
			success: function(responseMsg){
				//alert(responseMsg);
				$('#dialogNot').dialog('option', 'title', responseMsg);
			},
			error: function(msg){
				alert(msg);
			}
		});
		
		// se hace otra consulta con respecto al id de la noticia para obtener el contenido de ésta.
		$.ajax({
			type: "GET",
			url: "portalAcciones.php",
			data: "accion=5&id="+id,
			success: function(responseMsg){
				$('#dialogNot').html(responseMsg); 
				
				$.ajax({
					url : 'admin/bitLy.php',
					data : {
						accion :  "bitly",
						id: id
					},
					dataType : "json",
					type : "get",
					success: function(datos){
							var shortUrl="";
							
							$.each(datos.results, function (index, item){
								shortUrl= item.shortUrl;									
							});
							
							var cadenaLink="";
							cadenaLink='<a href="http://twitter.com/share" class="twitter-share-button" data-text="'+$('#dialogNot  #descripcionTwitter').val()+'" data-url="'+shortUrl+'" data-count="none" data-via="iestanahuac">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>&nbsp;&nbsp;&nbsp;&nbsp;';
							
							//$('#dialogNot table.contenidoNoticia').after(cadenaLink);
							$('#dialogNot #botonTweet').html(cadenaLink);
							
					}
				});
				
				contNoticia(id);
				id=null;
				
				// se calcula el ancho de la galeria de imagenes.. maximo 5 imagenes.
				if($("#picsGallery > li").length<6){
					width=$("#picsGallery > li").length*63;
				}else{
					width=5*63;
				}
				
				jQuery('#picsGallery').jcarousel({
					// Configuration goes here
					visible:5
				});
				
				$('#dialogNot .jcarousel-skin-tango .jcarousel-container-horizontal').css("width",width);
				$('#dialogNot .jcarousel-skin-tango .jcarousel-clip-horizontal').css("width",width);
				width=null;
				
				//alert($('#dialogNot .jcarousel-skin-tango .jcarousel-container-horizontal').css("height"));
				//alert($('#dialogNot .jcarousel-skin-tango .jcarousel-clip-horizontal').css("height"));
				//alert($('#dialogNot').css("height"));
			},
			error: function(msg){
				alert(msg);
			}
		});
		
		/*$('#eventosContenido').css("visibility","hidden");*/
		//$('#dialogNot').dialog('option', 'width', 530);
		
		$('#dialogNot').dialog('open');		
    	return false;
}


function vamos(url){
	alert(url);
}
//if (document.getElementById('informacion')) {
	
function cicloAcordion(time){
	cicloAcc=setInterval(function(){
			sel = $('#acordion .title').index($('#acordion .selected'));
			sel++;
			if (sel == $('#acordion .title').size()){
				acc.accordion("activate", 0);
			}else{
				acc.accordion("activate", sel);
			}
		},time);
}

function feedTwitter(){
	
	if(since_id == 0){
		data = 'include_entities=true&include_rts=true&screen_name=IESTANAHUAC&count=15&exclude_replies=true';
	}else{
		data = 'include_entities=true&include_rts=true&screen_name=IESTANAHUAC&count=15&exclude_replies=true&since_id='+since_id;
	}
	
	//console.log(data);
	$.ajax({
		type: "POST",
		url: 'includes/libraries/twitter/feeds.php', 
		dataType:'json',
		data: {accion : "timeline", loading : "first"},
		//success: function(resp){
				
	/*$.ajax({
		type: "GET",
		url: 'https://api.twitter.com/1/statuses/user_timeline.json', 
		dataType:'jsonp',
		data: data,*/
		/*success: function(resul){
			console.log(resul);
			
		  
		   for(i=0; i<10; i++){
			  //alert(resul[i].text);
			  //if (resul[i].user.id_str == '83944704')
				 $("#Tfeed").append(resul[i].text+"<br/>");
		   }
		}*/
		
		success: function(resp){
				if(resp.length >= 2){
					var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
					for(i=resp.length-2; i>-1; i--){
						var texto_tweet = resp[i].text;
						var palabras = texto_tweet.split(" ");
						var tweet = "";
						if(resp[i].id != since_id){
							for (j=0; j<palabras.length; j++){
								var mention_tt = palabras[j].substr(0,1);
								if(mention_tt == '@'){
									var especial = '<a href="http://twitter.com/'+palabras[j].substr(1,palabras[j].length-2)+'" target="_blank">';
									especial += "<span style='color: #2FC2EF'>"+palabras[j]+"</span></a>";
									tweet = tweet + especial + " ";
								}else if(mention_tt == '#'){
									var especial = '<a href="https://twitter.com/#!/search?q=%23'+palabras[j].substr(1,palabras[j].length-1)+'" target="_blank">';
									especial += "<span style='color: #2FC2EF'>"+palabras[j]+"</span></a>";
									tweet = tweet + especial + " ";
								}else if(regexp.test(palabras[j])){
									var especial = '<a href="'+palabras[j]+'" target="_blank">';
									especial += "<span style='color: #2FC2EF'>"+palabras[j]+"</span></a>";
									tweet = tweet + especial + " ";
								}else{
									tweet = tweet + palabras[j] + " ";
								}
							}
							//lastTweetID = resp[i].id;
							since_id = resp[i].id;
							$("#Tfeed ul").prepend("<li id="+resp[i].id+" class='cell_swipe' id_str="+resp[i].id_str+" tsn='"+resp[i].user.screen_name+"'  style='display: inline-block'><div style='display:inline-block; width:218px; border-bottom: 1px dotted #DDDDDD; margin-top:3px; margin-bottom:3px;'><!--div style='float: left; height:50px; width:50px'><img style='height:50px; width:50px' src='"+resp[i].user.profile_image_url+"'></div--><div style='float: left; margin-left:3px; width: 213px'><!--div style='display: inline-block;'><div style='float:left'><b>"+resp[i].user.screen_name+"</b></div><div style='float:left; margin-left: 5px; font-weight: normal'><span>"+resp[i].user.name+"</span></div></div--><div style='color: gray'><span>"+tweet+"</span></div></div></div></li>");
							
							$('#Tfeed').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
							$('#Tfeed .jScrollPaneContainer').css('border','none');
						}
						
					}
				}
			}
	});
	
}
	
function initWWW(){
	
	feedTwitter();
	
	$('img#facebookImg').click(function(){
		if($('#twitterImg').attr('status')=='on'){
			$('#twitterImg').attr('status','off');
			$('#twitterImg').attr('src','/includes/images/redes_twitterOFF.png');
			$('#facebookImg').attr('status','on');
			$('#facebookImg').attr('src','/includes/images/redes_facebookON.png');
			$('div#tfeedContenido div#Ffeed').css('display','block');
			$('div#tfeedContenido div#Tfeed').css('display','none');
		}
	});
	$('img#twitterImg').click(function(){
		if($('#facebookImg').attr('status')=='on'){
			$('#facebookImg').attr('status','off');
			$('#twitterImg').attr('src','/includes/images/redes_twitterON.png');
			$('#twitterImg').attr('status','on');
			$('#facebookImg').attr('src','/includes/images/redes_facebookOFF.png');
			$('div#tfeedContenido div#Tfeed').css('display','block');
			$('div#tfeedContenido div#Ffeed').css('display','none');
		}
	});
	
	/*setInterval(function(){
			feedTwitter();
		},100000);*/
	
	var playBtn="false";
	var contImgBol=0;
	var contImgBolAnt= 0;
	var tiempoAccordion = 20000;    //tiempo de acordeon 20 segs
	
	//clearInterval(cicloAcc);
	acc=null;
	indexAccordion = 0;
	//cicloAcc=null;
	if (document.getElementById('informacion')) {
		$('.fechaEvento').jScrollPane({showArrows:true, animateTo:true});
	}
	
	acc= $("#acordion").accordion({ header:'.title' ,event: 'mouseover', autoheight: false, active: 0});
	$('#acordion').jScrollPane({showArrows:true, animateTo:true});
	
	$('#imagen').css('cursor','pointer');
	img=$('#acordion a.selected').attr('img');
	paginaweb=$('#acordion a.selected').attr('paginaweb');
	abrir=$('#acordion a.selected').attr('abrir');
	$('#imagen').html('<img height="220" width="540" onClick="abreOpcion(this)" abrir="'+abrir+'" paginaweb="'+paginaweb+'" src="includes/images/acordion/'+img+'"/>');
	
	
	if (document.getElementById('conoce')) {
		//cicloAcordion(i,tiempoAccordion);
		cicloAcordion(tiempoAccordion);
		$('.ui-accordion').unbind("change.ui-accordion");
		$('.ui-accordion').bind("change.ui-accordion", function(event, ui) {
			img=$('#acordion a.selected').attr('img');
			paginaweb=$('#acordion a.selected').attr('paginaweb');
			abrir=$('#acordion a.selected').attr('abrir');
			$('#imagen').hide().html('<img height="220" width="540" onClick="abreOpcion(this)" abrir="'+abrir+'" paginaweb="'+paginaweb+'" src="includes/images/acordion/'+img+'"/>').fadeIn('slow');
			img=null;
			paginaweb=null;
			abrir=null;
			$('#acordion').jScrollPane({showArrows:true, animateTo:true});
		});
	}
	
	$('#acordion .content').hover(
		function () {
			$('#acordion a.selected').addClass('selectedHov');
		}, 
		function () {	
			$('#acordion a.selected').removeClass('selectedHov');			
	});
	
	$('#acordion .title,.content').hover(
		function () {
			clearInterval(cicloAcc);
			delete cicloAcc;
		}, 
		function () {
			//cicloAcordion($('#acordion .title').index($('#acordion .selected')),tiempoAccordion);   //cuando salga del area empieza el conteo para reiniciar el ciclo
			cicloAcordion(tiempoAccordion);
	});
	
	$('#tabs').tabs({
		select: function(event, ui) {
			$("div.ui-tabs-panel").empty(); 
		},
		show: function(event, ui) {
			if (ui.index == 1){
				initVideo();
			}
		}
				
	}); 
	   
	if($.browser.safari) { 
		$('#tabs>div').css("padding-top","20px");
	}

	$('#dialogNot').dialog({
		width: 700,//530,
		autoOpen: false,
		position: ['center','middle'],   /*150*/
		modal: true
		//close: function(ev, ui) { $('#eventosContenido').css("visibility","visible"); }
	});
	
	/*************************************Ilc  Eventos************************************************/
	
	if (document.getElementById('informacion')) {   // existe el elemento "informacion"   ???	
		var numImg=$('#slideshow ul>li').size();    // numero de imagenes del JCarrousel
		var contEventos=1;    						// contador para los eventos
		
		$('.descripcionEvento').hover(
		  function () {
			  if(!$('.fechaEvento #'+this.id).hasClass("eventoSelected")){				  
				if($('.fechaEvento #'+this.id).attr('class')== "descripcionEvento"){    // si No es el evento seleccionado
				//$('.fechaEvento #'+this.id+' .bordeUp').attr('class')=="bordeUp" && 
					$('.fechaEvento #'+this.id+' .bordeUp').addClass('bordeUpSelHo'); //$('.fechaEvento #f'+this.id+' .bordeUp').removeClass('bordeUp');
					$('.fechaEvento #'+this.id+' .bordeDn').addClass('bordeDnSelHo'); //$('.fechaEvento #f'+this.id+' .bordeDn').removeClass('bordeDn');
				}
			}
		  }, 
		  function () {
			  if(!$('.fechaEvento #'+this.id).hasClass("eventoSelected")){
				if($('.fechaEvento #'+this.id).attr('class')== "descripcionEvento"){   // si No es el evento seleccionado
				//$('.fechaEvento #'+this.id+' .bordeUpSel').attr('class')=="bordeUp bordeUpSel" && 
					$('.fechaEvento #'+this.id+' .bordeUpSelHo').removeClass('bordeUpSelHo'); //$('.fechaEvento #f'+this.id+' .bordeUpSel').addClass('bordeUp');
					$('.fechaEvento #'+this.id+' .bordeDnSelHo').removeClass('bordeDnSelHo'); //$('.fechaEvento #f'+this.id+' .bordeDnSel').addClass('bordeDn');
				}	
			  }
		  }
		);			
	
		/***********************Se crean las bolitas deacuerdo al numero de eventos ***********************************/
					
			$.ajax({
					type: "GET",
					url: "portalAcciones.php",
					data: "accion=3&numEventos="+numImg,
					success: function(responseMsg){
						$('#eventoSelec').html(responseMsg);
					},
					error: function(msg){
						alert(msg);
					}
				});	
			
			var playBtn="false";  // esta activado el boton de pausa
			$('#playBtn').addClass('pauseBtn');
			
			 
			var autoScroll="true";
			
			function mycarousel_initCallback(carousel, state) {
				carrusel = carousel;
				$('#playBtn').click(function(){	
				
					if(playBtn=="false"){            // se pone en pausa
						carousel.startAuto(0);
						$('#playBtn').removeClass('pauseBtn');
						$('#playBtn').addClass('playBtn');
						playBtn="true";
						autoScroll="false";
						if(regreso=="true"){
							regreso="false";
						}
					}else{               //       se pone en play
					
						$('#playBtn').removeClass('playBtn');
						$('#playBtn').addClass('pauseBtn');
						playBtn="false";
						autoScroll="true";
						/*alert(regreso+' '+autoScroll);   /**********************************hace el alert a true*****/
						
						if(contEventos==numImg){
							regreso="true";
							if(regreso=="true" && autoScroll=="true"){
								setTimeout(function(){
									if(playBtn=="false"){
										carousel.scroll(jQuery.jcarousel.intval(contEventos-1));
									}
								},8000);
							}		
						}
						else{
							carousel.startAuto(8);   // tiempo igual a  8000
						}								
						return false;	
						
					}
				 });
			
				carousel.buttonNext.bind('click', function() {
					if(playBtn=="false"){   
						$('#playBtn').removeClass('pauseBtn');
						$('#playBtn').addClass('playBtn');
						playBtn="true";
						//tempRegreso=regreso;
					}
					carousel.startAuto(0);
					autoScroll="false";
				});
			
				carousel.buttonPrev.bind('click', function() {
					if(playBtn=="false"){   
						$('#playBtn').removeClass('pauseBtn');
						$('#playBtn').addClass('playBtn');
						playBtn="true";
						//tempRegreso=regreso;
					}
					carousel.startAuto(0);
					autoScroll="false";
				});
			
			
				$('.descripcionEvento').click(function(){
					if(playBtn=="false"){   
						$('#playBtn').removeClass('pauseBtn');
						$('#playBtn').addClass('playBtn');
						playBtn="true";
						//tempRegreso=regreso;
					}
					
					var str=this.id;
					carousel.scroll(jQuery.jcarousel.intval(str.substring(1)));	
					str=null;
					
					$('.fechaEvento .eventoSelected').removeClass('eventoSelected');
					$('.fechaEvento .bordeUpSel').addClass('bordeUp');
					$('.fechaEvento .bordeUpSel').removeClass('bordeUpSel');
					$('.fechaEvento .bordeDnSel').addClass('bordeDn');
					$('.fechaEvento .bordeDnSel').removeClass('bordeDnSel');
					//alert(this.id);
					
					
					$(this).addClass('eventoSelected');	
					$('.fechaEvento #'+this.id+' .bordeUp').addClass('bordeUpSel');
					$('.fechaEvento #'+this.id+' .bordeUp').removeClass('bordeUp');
					$('.fechaEvento #'+this.id+' .bordeDn').addClass('bordeDnSel');
					$('.fechaEvento #'+this.id+' .bordeDn').removeClass('bordeDn');
					//alert($('.fechaEvento #'+this.id+' .bordeUp').attr('class'));
					carousel.startAuto(0);	
					autoScroll="false";
				 });
			};
			
			jQuery('#mycarousel-next').bind('click', function() {
				carousel.next();
				return false;
			});	
			jQuery('#mycarousel-prev').bind('click', function() {
				carousel.prev();
				return false;
			});
			
			/*function mycarousel_reloadCallback(carousel) {};*/	
			var regreso="false";	
			var rangoIni= 1;if(numImg<=8){var rangoFin=numImg;}else{var rangoFin=8;}
			var contImgBol=0;	
			/*var regreso="false";	
			var rangoIni= 1;if(numImg<=5){var rangoFin=numImg;}else{var rangoFin=5;}	
			var contImgBol=0;	*/
			function mycarousel_itemFirstInCallback(carousel, item, idx, state) {		
				contEventos=idx;
				$(".imagenesEventos").each(function(){
						if($(this).attr("id")==idx){
							$('#title').text($(this).attr("title"));
						}
				});
				
				if ($(".imagenesEventos").length == 0 ){
					carousel.itemFirstInCallback =null;
				}
				
				/******************************************para CAMBIAR LA BOLITA SELECCIONADAAA********/
				var contImgBolAnt= 0;
				contImgBolAnt=contImgBol;
				
				if(idx>rangoFin){   // el evento seleccionado es mayor al limite superior
					contImgBol=8;
					rangoFin=idx;
					rangoIni=idx-7;  // se restan 4 porke solo aparecen 5 bolitas!!!!! ****************************
					//alert("1er "+idx+"("+rangoIni+"-"+rangoFin+")");
				}else{
					if(idx<rangoIni){  // el evento seleccionado es menor al limite inferior
						contImgBol=1;
						rangoIni=idx;
						rangoFin=idx+7;  // se suman 4 porke solo aparecen 5 bolitas!!!!! ****************************	
						//alert("2do "+idx+"("+rangoIni+"-"+rangoFin+")");
					}else{                // el evento seleccionado se entre los limites
						contImgBol=idx-rangoIni+1;
					}
				}			
			
				//contImgBol=idx;
				if(contImgBolAnt!=0 && contImgBolAnt!=contImgBol){
					$('.bolSelec').addClass('bolNoSelec');
					$('.bolSelec').removeClass('bolSelec');
					$('#bol' + contImgBol).removeClass('bolNoSelec');
					$('#bol' + contImgBol).addClass('bolSelec');
				}
				/*if(contImgBolAnt!=0){
					$('.bolSelec').addClass('bolNoSelec');
					$('.bolSelec').removeClass('bolSelec');
					$('#bol' + idx).removeClass('bolNoSelec');
					$('#bol' + idx).addClass('bolSelec');
				}*/
				
				/*if(contImgBolAnt!=0){
					$('#bol'+contImgBolAnt).removeClass('bolSelec');
					$('#bol'+contImgBolAnt).addClass('bolNoSelec');	
					$('#bol'+contImgBol).removeClass('bolNoSelec');
					$('#bol'+contImgBol).addClass('bolSelec');	
				}*/
						
					
					if(idx==numImg && autoScroll=="true"){		
						carousel.startAuto(0);
						regreso="true";
					}	
					if(idx==1 && regreso=="true" && autoScroll=="true"){
						carousel.startAuto(8);    // tiempo iguakl a 8000
						regreso="false";
					}	
					if(regreso=="true" && autoScroll=="true"){
						setTimeout(function(){
							if(playBtn=="false"){
								carousel.scroll(jQuery.jcarousel.intval(idx-1));
							}
						},8000);
					}
					
				return false;
			};	
			/*function mycarousel_itemFirstOutCallback(carousel, item, idx, state) {};*//*function mycarousel_itemLastInCallback(carousel, item, idx, state) {};*//*function mycarousel_itemLastOutCallback(carousel, item, idx, state) {};*/	
			function mycarousel_itemVisibleInCallbackBeforeAnimation(carousel, item, idx, state) {		
				jQuery('img', item).fadeIn('slow');
				/*$('div #title').fadeIn('slow');*/
				
				var targetElementSelectorString = "#f"+idx;
				
				if (document.getElementById('informacion')) {
				
					if($('.descripcionEvento').size() > 3){
						$('.fechaEvento')[0].scrollTo(targetElementSelectorString);
						
					}
					targetElementSelectorString=null;
					
					$('.fechaEvento .eventoSelected').removeClass('eventoSelected');
					
					$('.fechaEvento .bordeUpSel').addClass('bordeUp');
					$('.fechaEvento .bordeUpSel').removeClass('bordeUpSel');
					$('.fechaEvento .bordeDnSel').addClass('bordeDn');
					$('.fechaEvento .bordeDnSel').removeClass('bordeDnSel');
					
					$(".fechaEvento #f"+idx).addClass('eventoSelected');	
					$('.fechaEvento #f'+idx+' .bordeUp').addClass('bordeUpSel');
					$('.fechaEvento #f'+idx+' .bordeUp').removeClass('bordeUp');
					$('.fechaEvento #f'+idx+' .bordeDn').addClass('bordeDnSel');
					$('.fechaEvento #f'+idx+' .bordeDn').removeClass('bordeDn');	
				}
			};
			/*function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {};*/
			function mycarousel_itemVisibleOutCallbackBeforeAnimation(carousel, item, idx, state) {
				jQuery('img', item).fadeOut('slow');
				/*$('div #title').fadeOut('slow');*/
			};
			/*function mycarousel_itemVisibleOutCallbackAfterAnimation(carousel, item, idx, state) {};*/
			
			jQuery('#mycarousel').jcarousel({
				auto:8,    // tiempo igual a 8000
				scroll: 1,
				animation:1000,	
				initCallback:   mycarousel_initCallback,//reloadCallback: mycarousel_reloadCallback,    //buttonNextCallback:   mycarousel_buttonNextCallback, //buttonPrevCallback:   mycarousel_buttonPrevCallback,
				itemFirstInCallback:  mycarousel_itemFirstInCallback,//itemFirstOutCallback: mycarousel_itemFirstOutCallback, //itemLastInCallback:   mycarousel_itemLastInCallback, //itemLastOutCallback:  mycarousel_itemLastOutCallback,
				itemVisibleInCallback: {
					onBeforeAnimation: mycarousel_itemVisibleInCallbackBeforeAnimation /*onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation*/
				},
				itemVisibleOutCallback: {
					onBeforeAnimation: mycarousel_itemVisibleOutCallbackBeforeAnimation /*onAfterAnimation:  mycarousel_itemVisibleOutCallbackAfterAnimation*/
				}
			});
		}
}	
	

	

/****************** GOOGLE ***************************/
	var searchControl;
/****************** GOOGLE ***************************/


function buscaEnGoogle(){
	var options = new google.search.DrawOptions();
	options.setSearchFormRoot(document.getElementById("searchForm"));
	searchControl.draw(document.getElementById("contenidoSitio"), options);
	textoBusqueda = document.getElementById("textBuscador").value;
	searchControl.execute(textoBusqueda);
	$.each($('.gs-title'), function (index, obj){
		pagina = $(obj).attr('href');
		$(obj).attr('paginaWeb', pagina);
		$(obj).removeAttr('href');
	});
	
	$('.gs-title').unbind('click');
	$('.gs-title').bind('click', function (){
		abreOpcion(this);
	});
}


$(document).ready(function() {
		//$('#scrollMenuOpcion').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
		//$('#scrollMenuOpcion').css('width', '220px');
		//$('#menuLateral .jScrollPaneContainer').css('border','none');
		$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});
		$('#cont .jScrollPaneContainer').css('border','none');
		//$('.fechaEvento').scrollTo( 0 ); //$.scrollTo( 0 ); //$('#imagen').jScrollPane({showArrows:true, animateTo:true}); //$('#seccionesConoce').jScrollPane({showArrows:true, animateTo:true});
		
/****************** GOOGLE ***************************/
		$('#textBuscador').unbind('focus');
		$('#textBuscador').bind('focus', function (){
			if ($(this).val() == 'Buscar'){
				$(this).val('');
			}
		});
		
		$('#textBuscador').unbind('blur');
		$('#textBuscador').bind('blur', function (){
			if ($(this).val() == ''){
				$(this).val('Buscar');
			}
		});
		
		$('#textBuscador').unbind('keypress');
		$('#textBuscador').bind('keypress', function (tecla){
			if (tecla.which == 13){
				buscaEnGoogle();
			}
		});
			
		searchControl = new google.search.CustomSearchControl('009442159862480933257:objcvd1jduu');
	
		$("#lupa").click(function(){
			buscaEnGoogle();
		});
	
/****************** GOOGLE ***************************/
		
		 if ($.browser.msie) {
			$('#menuLateral').corner("top 4px").corner("bl 5px")
			$('#menuServiciosEncabezado').corner("top 5px");
			$('#menuEventosEncabezado').corner("top 5px");
			$('.eventoSelected').corner("5 px");
			$('.descripcionEvento:hover').corner("5 px");//$('.fechaEventoBlanco').corner("2px");			
		 }		 
		
		$(function(){
			$('ul.jd_menu').jdMenu();
		});
		
		/*$("#contenidoSitio").load("inicio/inicio.php", function(){
			initWWW();
		});*/
		
		if($('#idNoticiaO').val() != ""){
			$("#contenidoSitio").load("inicio/inicio.php?idNoticia="+$('#idNoticiaO').val(), function(){
				initWWW();
			});
		}else if($('#idPagO').val() != ""){
			if (acc != undefined){
				clearInterval(cicloAcc);
				$("#acordion").accordion('destroy');
			}
			if(carrusel){
				carrusel.destroy();						
			}
			$('#contenidoSitio').load($('#idPagO').val(), function(){
				initWWW();
				$('#contenidoSitio').jScrollPane({showArrows:true, animateTo:true, wheelSpeed:35});	
				$('#cont .jScrollPaneContainer').css('border','none');
			});
		}else{
			$("#contenidoSitio").load("inicio/inicio.php", function(){
				initWWW();
			});
		}
		
		
		
	});



