function ocultar_foto(){
	$('#fndlayer').fadeTo(500,0,function(){ $('#fndlayer').css({display : "none"}); mostrar_swf(); });
	$('#layer').fadeTo(500,0,function(){ $('#layer').css({display : "none"}); });	
}

function ocultar_fnd_layer(){
	$('#fndlayer').fadeTo(500,0,function(){ $('#fndlayer').css({display : "none"}); });
	$('#layer').fadeTo(500,0,function(){ $('#layer').css({display : "none"}); });	
}

function ocultar_swf(){
	$('#id_flash_cabezal').hide();
	/*$('#reloj').hide();
	$('#id_tipo_sel').css({'visibility':'hidden'});
	$('#id_zona_sel').css({'visibility':'hidden'});
	$('#id_estrellas_sel').css({'visibility':'hidden'});
	$('#contactarse').css({'visibility':'hidden'}); */
}

function mostrar_swf(){
	$('#id_flash_cabezal').show();
	/*$('#reloj').show();
	$('#id_tipo_sel').css({'visibility':'visible'});
	$('#id_zona_sel').css({'visibility':'visible'});
	$('#id_estrellas_sel').css({'visibility':'visible'});
	$('#contactarse').css({'visibility':'visible'}); */
}

/************************** **************************************************************************************************/
// from : http://www.dynamicdrive.com/dynamicindex4/lightbox
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

/************************** **************************************************************************************************/

/*var sumar_a_alto_general = 0;

function show_full_img(img, id){
	ocultar_swf();
	
	if(id == 4){
		sumar_a_alto_general = 23;
	}else{
		sumar_a_alto_general = 0;
	}
	
	$('#fndlayer').css({opacity : "0"});
	$('#fndlayer').css({display : "block"});
	$('#fndlayer').fadeTo(500,.8);
	
	$('#layer').css({opacity : "0"});
	$('#layer').css({display : "block"});
	var __left = ($(window).width() / 2) - ($('#layer').width() / 2);
	$('#layer').css({left : __left+"px"});
	var __top = getPageScroll();
	$('#layer').css({top : (__top[1]+20)+"px"});
				
		$.ajax({ 
		  type: "POST", 
		  url: "loadfullimg.php", 
		  data: "idg="+id+"&img="+img, 
		  success: function(txt){ 
				$('#layer').html(txt);
				$('#layer').fadeTo(500,1,function(){
					if(($.browser.msie)){ var add_w = 30; al_img += 15; }
					else{ var add_w = 0;}
					if(an_img < 250){
						an_img = 250;
					}
					al_img += 90;
					al_img += sumar_a_alto_general;
					an_img += add_w;
									
					al_old = al_img;
					an_old = an_img;
//					alert(an_img + ' -- ' + al_img);
					$('#div_foto_ppal_cargada').animate({width: an_img},'slow',function(){
						$('#div_foto_ppal_cargada').animate({height: al_img},'slow',function(){
							$('#foto_ppal_cargada').fadeIn('slow');
							$('#div_flechas_cargada').show();
						});
					});
				});
		  } 
		}); 
}*/

function show_full_img(img, w, h, texto_cerrar){
	ocultar_swf();
	
	$('#fndlayer').css({opacity : "0"});
	$('#fndlayer').css({display : "block"});
	//if(!$.browser.msie){ $('#fndlayer').width( $('#fndlayer').width() + 15 ) }
	$('#fndlayer').fadeTo(500,.8);
	
	$('#layer').width(w+40);
	$('#layer').css({width : (w+40)+"px"});
	document.getElementById('layer').style.width = (w+40)+"px";
	$('#layer').height(h+50);
	
	$('#layer').css({opacity : "0"});
	$('#layer').css({display : "block"});
	
	// por problemas con ie6 (q raro)
	var ancho_real = document.getElementById('layer').style.width.split('px')[0];
	
	var __left = ($(window).width() / 2) - ( ancho_real / 2);
	$('#layer').css({left : __left+"px"});
	var __top = getPageScroll();
	$('#layer').css({top : (__top[1]+50)+"px"});

	txt = '<br /><img onclick="ocultar_foto()" src="fotos/'+img+'" alt="" title="" /><br /><span onclick="ocultar_foto()" class="span_cerrar">'+texto_cerrar+'</span>';
	
	$('#layer').html(txt);
	$('#layer').fadeTo(500,1);
	
}
