function GetThis(T, C, U, L)
{
    var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T)
    + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
    window.open(targetUrl);
}
$(document).ready(function(){
	$(".bloque1 ul li a").click(function(){
			este = $(this);
		
			$(".video object").hide(1, function() { 
				blackout();
				
				$('body').append('<div id="eventosFlyerIMG"><img src="images/loading.gif" alt="Cargando..." class="loading" /><img src="'+este.attr('href')+'" width="'+este.attr('iw')+'" height="'+este.attr('ih')+'" style="display: none;" class="flyer" /></div>');
				
				var wh = windowSize();
				var iz = {width: (wh.width - 24) / 2, height: (wh.height - 24) / 2};
				
				$('#eventosFlyerIMG .loading').css({
					position: 'absolute',
					top: iz.height+'px',
					left: iz.width+'px'
				});
				
				$('#eventosFlyerIMG .flyer').load(function() {
					var wh = windowSize();
					var iz = {width: (wh.width - $(this).width()) / 2, height: (wh.height -  $(this).height()) / 2};
					
					//alert(iz.width + ' - ' + iz.height);
					$('#eventosFlyerIMG .loading').remove();
					
					$(this).css({
						position: 'absolute',
						top: iz.height+'px',
						left: iz.width+'px',
						zIndex: 101
					}).fadeIn('slow');
				});
				
				$('#eventosFlyerIMG img, #blackout').click(function() {
					clearBlackout();
					$('#eventosFlyerIMG').remove();
					
					$('.video object').fadeIn(0);
		
				});				
			});
		
		return false;
	});
	
	$('#buscador_actividades').submit(function(){
		var buscar = $("input:buscar").attr('value');			
		$.get('actividades/buscar.php', {nombre:buscar}, function(resultados){						
			eval('resultados = '+resultados);				
			$(".bloque2").html('<ul></ul>');
			
			for (i in resultados) {
				$(".bloque2 ul").append('<li><a href="?actividad='+resultados[i].id+'&video='+resultados[i].video+'"><strong>'+resultados[i].nombre+'</strong></a></li>');
			}
		});			
		return false;
	});
	
	/*$('.thm').click(function(){ ---------------------->>>>> CUIDADO CON FACEBOOK!!!!!!!
		
		var x = $(this).children('a').attr('href');				
		$.getJSON(x, function(datos){			
			$('#nombre_video').val(datos.id);			
			var video = '<object type="application/x-shockwave-flash" data="eventos/player_flv_maxi.swf" width="300" height="250"><param name="movie" value="eventos/player_flv_maxi.swf" /><param name="allowFullScreen" value="true" /><param name="FlashVars" value="showiconplay=1&amp;flv=../actividades/videos/'+datos.directorio+'/'+datos.video+'&amp;width=295&amp;height=250&amp;showtime=1&amp;srt=0&amp;skin=0&amp;margin=10&amp;startimage=../actividades/imagenes/'+datos.directorio+'/td/'+datos.imagen+'&amp;playercolor=cccccc&amp;buttoncolor=333333&amp;buttonovercolor=999999&amp;showvolume=1&amp;slidercolor1=333333&amp;slidercolor2=0&amp;sliderovercolor=999999&amp;loadingcolor=0&amp;showfullscreen=1" /><p>Video no Encontrado</p></object>';			
			$('.video').html(video);								
			$('.descripcion_event').text(datos.descripcion);
			$('input#nombre_video').attr('value', datos.video);				
		});
		return false;			
	});
	*/
	$('.enviar_amigo a').click(function() {
		$('#formEnviarAmigo').slideToggle('slow');
		return false;
	});
	$('.ver_cal').click(function() {
		$('#contenedor_eventos .calendario').fadeIn('fast', function() {
			$('.close_cal a').click(function() {
				$('.#contenedor_eventos .calendario').fadeOut();
			});
		});
	});
	
	var th = $('.vcarucel .thm a img').length;
	var c = Math.ceil(th / 18);
	var up = 1;
	
	$('a.down').click(function() {
		if(c > 1 && up < c) {			
			$(".vcarucel").animate({top:"-=265px"},{duration: 800});
			up++;			
		}
		return false;
	});
	
	$('a.up').click(function() {
		if(c > 1 && up > 1) {
			$(".vcarucel").animate({top:"+=265px"},{duration: 800});
			up--;	
		}
	});
});	
