//##############################################################################
function myWindow(titolo,content,w,h,foot){
	
	this.titolo=titolo;
	this.content=content;
	if(!w) 
		this.w=400;
	else
		this.w=w;
	if(!h) 
		this.h=300;		
	else
		this.h=h;
	this.foot=foot;

	//metodi	
	this.build=window_build;
	this.resize=window_resize;
	this.show=window_show;
	
	this.build();
}
function window_show(){
	$('divPopup_win').style.display="block";

}
function window_build(){
	
	$('blkWindow').style.cssText='display:block;height:'+screen.availHeight+'px;';

	if(this.titolo) $('divPopup_tit').innerHTML=this.titolo;	
	
	
	var r_pos=0;
	if(isIE)
		r_pos=20;	
	$('divPopup_tit').innerHTML+='<img style="position:absolute;right:' + r_pos + 'px;top:12px;cursor:pointer;" onclick="close_divPopup()" src="'+guiPath+'/images/ico_close.gif"/>';


	//FOOT	
	if(this.foot) 
		$('divPopup_foot').innerHTML=this.foot;
	else
		$('divPopup_foot').hide();
	
	$('divPopup_txt').innerHTML=this.content;
	
}

function window_resize(){
	//$('blkWindow').style.cssText='display:block;height:'+screen.availHeight+'px;';
	//alert(screen.availHeight)
	$('divPopup_tit').style.width=(this.w+10)+'px';
	$('divPopup_txt').style.cssText='width:' + this.w + 'px;text-align:left;';
	
	var winH=0;
	if(isIE){
		winH = (document.documentElement.clientHeight - this.h - $('thumbs').offsetHeight - 80)/2 + 'px';
	}else{
		winH = (window.innerHeight- this.h - $('thumbs').offsetHeight - 80)/2 +80+ 'px';
	}
	//alert(winH)
	//alert(document.documentElement.clientHeight + ' - ' + $('thumbs').offsetHeight + ' - ' + this.h + ' - 80)/2 = ' + winH );
	var debug='document.documentElement.clientHeight:'+document.documentElement.clientHeight;
	debug+='<br>thumbs.offsetHeight:'+$('thumbs').offsetHeight;
	debug+='<br>winH:'+winH;
	//$('win_debug').innerHTML=debug;
	//$('divPopup_tit').innerHTML+='<div id="win_debug" style="position:absolute;left:-200px;top:0;background-color:#fff;">'+debug+'</div>';
	
	if(parseInt(winH) < 0 ) winH='2px';	
	
	$('divPopup_win').style.cssText='display:none;margin-left:'+ -(this.w + 20)/2 +'px;width:'+ ( this.w + 20) +'px;top:'+winH+';border:solid 0px;';
}

//##############################################################################

function close_divPopup(){
	$('blkWindow').style.cssText='display:none;';
	$('divPopup_win').style.cssText='display:none;';
	$('divPopup_txt').innerHTML='';
}
// #####################################################