function mostrarVisitas(nombre){
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	$('#layerOverlay').height(arrayPageSize[1] + 'px');
	$('#layerOverlay').width(arrayPageSize[0] + 'px');
	$('#layerOverlay').show();
	$('#layerOverlay').click(function (){ ocultarVisitas(); });
	

	$('#layerVisitas').html(getFlashCode(nombre));
	$('#layerVisitas').css('top', (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - $('#layerVisitas').height())/2) + 'px'));
	$('#layerVisitas').css('left',((arrayPageSize[0]-$('#layerVisitas').width())/2)+50+'px');
	$('#layerVisitas').show();
	
	//$('#layerLinks_close').click(function (){ hideLinks(); });
	//
	//$('#layerLinks ul li a').click(function (){ hideLinks(); });

}

function ocultarVisitas(){

	$('#layerOverlay').hide();
	$('#layerVisitas').hide();

}

function getFlashCode(id){

	var code = '';
	var url= "../_img/visitas-virtuales/"+id+"/panorama.swf";
	

	code += '<div class="visita_head"> ';
	code += '<div style="float:left"><strong>Haz "click y arrastra" para moverte por la panorámica</strong></div>';
	code += '<div style="float:right"><a href="javascript:ocultarVisitas();">cerrar</a></div>';
	code += '<div style="clear:both"></div>';
	code += '</div>';
	
	code += '<OBJECT ';
	code += 'id="flash_'+id+'" '; 
	code += 'codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"  ';
	code += 'width="590" height="350"  ';
	code += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  ';
	code += 'name="flash_'+id+'" ';
	code += '><PARAM NAME="Movie" VALUE="'+url+'"> ';
	code += '  <PARAM NAME="Src" VALUE="'+url+'"> ';
	code += '  <PARAM NAME="WMode" VALUE="Opaque"> ';
	code += '  <PARAM NAME="BGColor" VALUE="ffffff"> ';
	code += '  <PARAM NAME="Quality" VALUE="High"> ';
	code += '  <PARAM NAME="AllowScriptAccess" VALUE="always"> ';
	code += '  <embed ';
	code += '    width="590" ';
	code += '    height="350"  ';
	code += '    type="application/x-shockwave-flash"  ';
	code += '    pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"  ';
	code += '    quality="high"  ';
	code += '    src="'+url+'"  ';
	code += '    id="flash_'+id+'"  ';
	code += '    name="flash_'+id+'"  ';
	code += '    allowscriptaccess="always"  ';
	code += '    bgcolor="#ffffff"  ';
	code += '    wmode="opaque"  ';
	code += '    /></OBJECT>';
	
		return code;
}

/*

 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;
	var windowWidth, windowHeight;

	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;
	}

	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;

}

//
// 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;
}
