$(function(){
	$('img.thumbnail').hover(function(e){
		var ofy= 350;
		var ofx= 20;
		var ref = $(this).attr('src');
		$('<img src="'+ ref +'" border="0" id="fullsize" />')
		.css('top', e.pageY - ofy)
		.css('left', e.pageX + ofx)
		.appendTo('body').hide().fadeIn('medium');
	
	},function(){
		$('img#fullsize').remove();
	});
	
	$('img.thumbnail').mousemove(function(e){
		$('img#fullsize')
		.css('top', e.pageY - 350)
		.css('left', e.pageX + 20);
		})
	$(window).load(function () {
    	var hr=$('a.show360:first').attr('href');
		$('div#info').remove();
		$.ajax({
					url: hr,
					type: 'GET',
					data: '',
					
					success: function(result) {
						$('#info').remove();
						$('<div id="info"><div style="text-align:right"><a href="'+hr+'">FullScreen</a></div>' + result + '</div>').appendTo('#container');
						//$('#container').slideDown('slow');
						/*$('#loading').fadeOut(500, function() {
							$(this).remove();
						});*/
						
					}
				});
    });

	
	
	$('a.show360').click(function() {
		var href = $(this).attr('href');
		//$('#container').hide();
		$('div#info').remove();
		$.ajax({
					url: href,
					type: 'GET',
					data: '',
					
					success: function(result) {
						$('#info').remove();
						$('<div id="info"><div style="text-align:right"><a href="'+href+'">FullScreen</a></div>' + result + '</div>').appendTo('#container');
						//$('#container').slideDown('slow');
						/*$('#loading').fadeOut(500, function() {
							$(this).remove();
						});*/
						
					}
				});
		
		return false;
	});
	
	
	//$('a#closethis').click(function() {alert('debug');});
	
	
	$('a.openthis').click(function() {
		var href = $(this).attr('href');
		$('div#showing').remove();
		$.ajax({
					url: href,
					type: 'GET',
					data: '',
					
					success: function(result) {
						$('#showing').remove();
						$('<div id="showing"><script>$(function(){$(\'a#closethis\').click(function() {$(\'#showing\').remove();});})</script><div style="text-align:right;"><a href="#" id="closethis">Cerrar</a></div><br />' + result + '</div>').appendTo('body');
					}
				})
		
		return false;
	});
	
	
	
});