$(document).ready(function(){

$(".JQArea").click(function(event){
   event.preventDefault();
   //$(this).hide("slow");
	var winWidth = $(window).width();
	//var winHeight = $(window).height();
	var winHeight = $(document).height();
	var imgWidth = $(this).attr("__w");
	var imgHeight = $(this).attr("__h");
	
	var	bgCss = {
		'position': 'absolute',
		'top': '0px',
		'left': '0px',
		'background': 'url(img/semitrans.png) repeat',
		'width': winWidth+'px',
		'height': winHeight+'px',
		'display':'inline'
		}
		
   $("#sfondoID").css(bgCss);
   //$("#sfondoID").fadeIn("fast");
   $("#imgFrameID").append("<img id='newImgID' alt='' src='quadri/s"+$(this).attr("alt")+".jpg' />").click(function(event) {clearAll()});
   //$("#imgFrameID").append("<div>dida dida</div>");
   //alert($(this).attr("alt"));
   var imgFrameTop = Math.round((($(window).height()/2)+$(document).scrollTop( ))-(imgHeight/2));
   var imgFrameLeft = Math.round((winWidth/2)-(imgWidth/2));
   var	imgFrameCss = {
		'position': 'absolute',
		'top': imgFrameTop+'px',
		'left': imgFrameLeft+'px',
		'background-color': '#FFF',
		'padding': '10px',
		'display':'inline'
		}
   
   $("#imgFrameID").mouseover(function(event){$(this).css({'cursor':'pointer'})});
   $("#imgFrameID").mouseout(function(event){$(this).css({'cursor':'default'})});
   $("#imgFrameID").css(imgFrameCss);
   
   if (jQuery.browser.opera) {
   $("#newImgID").ready(function() {
   //$("#newImgID").css({'display':'inline'});
   $("#newImgID").slideDown("slow");
   });
   }
   else {
   $("#newImgID").load(function() {
   $(this).slideDown("slow");
   });
   }
   
 });

 /*temp rightclick*/
$("#imgFrameID").rightClick( function(e) {
return false;
});
$("#imgFrameID").noContext();
 /*temp rightclick/end*/
 
 });
 
 function clearAll() {
 $("#imgFrameID").empty();
 $("#imgFrameID").css({'display':'none'});
 $("#sfondoID").css({'display':'none'});
 }
