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){
		
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
		
	} else { 
		
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
		
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	
		
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
		
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
		
	} else if (document.body) { 
		
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
		
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){
		
		pageWidth = windowWidth;
		
	} else {
		
		pageWidth = xScroll;
		
	}

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

}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		
		yScroll = self.pageYOffset;
		
	} else if (document.documentElement && document.documentElement.scrollTop){
		
		yScroll = document.documentElement.scrollTop;
		
	} else if (document.body) {
		
		yScroll = document.body.scrollTop;
		
	}

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

}

function openSplash(imageWidth,imageHeight,tipo) {
	
	var arrayPageSize 					= getPageSize();
	var arrayPageScroll 				= getPageScroll();

	var closeSplashDiv					=	document.createElement('a');
	
  closeSplashDiv.setAttribute('href','javascript:closeSplash();');
	closeSplashDiv.setAttribute('id','closeSplashDiv');		
	
	var splash	=	document.createElement('div');
	
	splash.className						=	'splash';
	splash.setAttribute('id','splash');
	splash.style.position				=	'absolute';
	splash.style.zIndex 				= 1000;
	splash.style.display				=	'block';
	splash.style.top						=	'0px';
	splash.style.left						=	'0px';		
	splash.style.width					=	"99.9%";
	
	splash.style.border					=	"1px solid #ffffff";
	
	
	
	splash.style.height					= arrayPageSize[1]+100+"px";
	splash.style.background			= '#000000';
	
	splash.style.opacity = 7/10;
	splash.style.filter = 'alpha(opacity=' + 7*10 + ')';
	
	splash.style.overflow 			= 'hidden';

	closeSplashDiv.appendChild(splash);
			
	document.getElementsByTagName('body')[0].appendChild(closeSplashDiv);
		
	var closeLink									=	document.createElement('a');
  closeLink.setAttribute('href','javascript:closeSplash();');
	closeLink.setAttribute('id','closeLink');		

	var seperator	=	document.createElement('div');
	
	seperator.className							=	'seperator';
	seperator.setAttribute('id','seperator');
	seperator.style.position				=	'absolute';
	seperator.style.zIndex 					= 1001;
	seperator.style.padding					=	'5px';
	seperator.style.display					=	'block';
	seperator.style.width						=	"434px";
	seperator.style.height					=	"601px";
	seperator.style.border					=	"1px solid #000000";
	seperator.style.background			= '#000000';
	seperator.innerHTML							= "<div style='text-align: right; width: 434px; font-family: Arial;'></div>";	

	var immagine										=	document.createElement('div');
	
	immagine.className					=	'immagine';
	immagine.setAttribute('id','immagine');
	immagine.style.position			=	'absolute';
	immagine.style.zIndex 			= 1001;

	seperator.style.top 				= arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imageHeight) / 8) + 'px';
	seperator.style.left 				= (((arrayPageSize[0] + 120 - imageWidth) / 2) + 'px');

	immagine.style.display			=	'block';
	immagine.style.opacity 			= 10/10;
	immagine.style.filter 			= 'alpha(opacity=' + 10*10 + ')';	

	if (tipo == 1)	{	immagine.innerHTML = "<a href='javascript:closeSplash();'><img src='http://www.cgilsistemaservizi.it/design/cs_user/images/manifesto.gif' border='0' /><div style='background:#000;padding:3px 10px;margin:0 -6px;color:#fff;font:normal 15px arial;'>	<span style='display:block;font:normal 18px courier;color:#f00;float:left;margin:-2px 5px 0 0;'>[x]</span> clicca per chiudere</div></a>"; }
		
	seperator.appendChild(immagine);
	
	closeLink.appendChild(seperator);
			
	document.getElementsByTagName('body')[0].appendChild(closeLink);

}

function closeSplash() {
	
	document.getElementsByTagName('body')[0].removeChild(document.getElementById("closeSplashDiv"));	

	document.getElementsByTagName('body')[0].removeChild(document.getElementById("closeLink"));	

	document.getElementsByTagName('html')[0].style.overflow 	= 'auto';
	
}